In our app we integrate a lot of external sources, among them OneDrive.
We are integrated with OneDrive (before SkyDrive) since a couple of years. Last year, as it was asked by our users to support ODfB, we changed the SDK into OneDrive SDK (from CocoaPods, interference was the pod ADALiOS). It worked well.
However, since last month this integration stopped to work. Please see below detailed information.
Currently during log in to ODfB account, we get error:
“There was a problem logging you in. Could not discover the api endpoint for the given user. Make sure you have correctly enabled the SharePoint files permissions in Azure portal." Error code: 1
The Access settings should be correct, we set these with this instructions: https://dev.onedrive.com/index.htm
We have a problem with getting the correct address of resources URL
When we send request for services: in response we get only capability of Directory, and not like in documentation: MyFiles.
{
"@odata.context" = "https://api.office.com/discovery/v2.0/me/$metadata#allServices";
value = (
{
"@odata.editLink" = "services('Directory@[email protected]')";
"@odata.id" = "https://api.office.com/discovery/v2.0/me/services('Directory@[email protected]')";
"@odata.type" = "#Microsoft.DiscoveryServices.ServiceInfo";
capability = Directory;
entityKey = "Directory@[email protected]";
providerId = "…";
providerName = Microsoft;
serviceAccountType = 2;
serviceApiVersion = "v1.0";
serviceEndpointUri = "https://graph.windows.net/miknobuisness.onmicrosoft.com/";
serviceId = AZURE;
serviceName = "Microsoft Azure";
serviceResourceId = "https://graph.windows.net/";
}
);
}
When we request other rest: allServices, the response has more descriptions:
{
"@odata.context" = "https://api.office.com/discovery/v2.0/me/$metadata#allServices";
value = (
{
"@odata.editLink" = "allservices('Directory@AZURE')";
"@odata.id" = "https://api.office.com/discovery/v2.0/me/allservices('Directory@AZURE')";
"@odata.type" = "#Microsoft.DiscoveryServices.ServiceInfo";
capability = Directory;
entityKey = "Directory@AZURE";
providerId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
providerName = Microsoft;
serviceAccountType = 2;
serviceApiVersion = "";
serviceEndpointUri = "http://azure.microsoft.com/";
serviceId = AZURE;
serviceName = "Microsoft Azure";
serviceResourceId = "<null>";
},
{…},
{
"@odata.editLink" = "allservices('MyFiles@O365_SHAREPOINT')";
"@odata.id" = "https://api.office.com/discovery/v2.0/me/allservices('MyFiles@O365_SHAREPOINT')";
"@odata.type" = "#Microsoft.DiscoveryServices.ServiceInfo";
capability = MyFiles;
entityKey = "MyFiles@O365_SHAREPOINT";
providerId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
providerName = Microsoft;
serviceAccountType = 2;
serviceApiVersion = "";
serviceEndpointUri = "http://www.microsoft.com/en-us/office365/online-software.aspx";
serviceId = "O365_SHAREPOINT";
serviceName = "Office 365 SharePoint";
serviceResourceId = "<null>";
}
In documentation is info about we should get address of serviceEndpointUri and serviceResourceId, but they are wrong.
Can you help us please?
I reported it also on github: https://github.com/OneDrive/onedrive-sdk-ios/issues/95
The allservices
API is for informational purposes, i.e. for you as a human developer to see what you can roughly get. To remove any obstacles from your learning path, we've made it anonymous, so you can hit through your browser right away. The downside of that is that without an actual OAuth token, the service can't determine the exact endpoint URI and the resource URI (at least not in all cases.) That's why we've decided to give you information about the service through the serviceEndpointUri
property, but we couldn't think of anything else useful that we could return as resourceUri
. That's why it's null.
services
is the real API. That's what your app will hit. Once you become familiar with the process of obtaining OAuth tokens, you should start hitting this API interactively too to see some real responses.
The capabilities returned by the services
API depend on the scope in the OAuth token. (A great tool to open an Azure OAuth token is http://calebb.net. Look for the scp
claim.)
So requirement #1 is that your app has a files-related scope. See http://graph.microsoft.io/en-us/docs/authorization/permission_scopes.
Requirement #2 is that the user on whose behalf your app is calling, has a valid SharePoint license.