OneDrive / onedrive-sdk-ios

OneDrive SDK for iOS
https://dev.onedrive.com
Other
100 stars 88 forks source link

Issue with sharepoint access - bad request error #147

Closed abhpuur closed 8 years ago

abhpuur commented 8 years ago

I am able to access one drive for business using the sample poc iOSExplorer. But when I use the following code to access a sharepoint site, after the successful authentication (auth is using okta login 2 step verify), I do not see permissions screen but get an error "Sorry, but we're having trouble signing you in. We received a bad request".

Here are the details: in appdelegate ODClient is set using: [ODClient setActiveDirectoryAppId:@"a1467700-854d-4426-8caf-18a9e6a735f2" resourceId:@"https://_.sharepoint.com/" apiEndpoint:@"https://_.sharepoint.com/_api/v2.0/" redirectURL:@"iOSExplorer_ES://com.abhi.iOSExplorerES"];

All the permissions are provided in azure portal and the appid and redirect URL match with the values above. What could be the issue? The documentation on using sharepoint with onedrivesdk can definitely be improved!

kevklam commented 8 years ago

The resourceId and apiEndpoint you are specifying are not for a valid tenant.

First make sure you've followed the steps under "Register your app for OneDrive for Business" at the following link: https://dev.onedrive.com/app-registration.htm

If you want the app to work only for a specific tenant, then specify that tenant for the resourceId/apiEndpoint. Otherwise, do not specify them:

[ODClient setActiveDirectoryAppId:@"a1467700-854d-4426-8caf-18a9e6a735f2"
redirectURL:@"iOSExplorer_ES://com.abhi.iOSExplorerES"];

Hope this helps.

-Kevin

abhpuur commented 8 years ago

Hi Kevin: As I mentioned I am trying to show contents of a sharepoint site and not onedrive. Sorry the endpoint and resourceid got changed in comment while I was trying to italicize here. I can't specifiy the company name here but its a valid tenant and I had followed the steps provided for app registration.

resourceId:@"https://.sharepoint.com/" apiEndpoint:@"https://.sharepoint.com/_api/v2.0/"

Also, when I try to connect to a different sharepoint to which the user logging in has group admin privilege it works ok. could it be a permissions issue? Another important difference is in the first case the login is via Okta and after that is successful, the permissions screen never appears.

kevklam commented 8 years ago

Is there a more specific error code showing up in small print by any chance?

abhpuur commented 8 years ago

this was an access related issue, closing for now.