I have a client application that uses the Office 365 SharePoint Preview API. Recently (as of October 2014) Microsoft has published version 1.0 of this API . The authentication steps used with the preview API no longer work with version 1.0.
To demonstrate the problem, I created a short node.js script . The script does the following:
- Allows launching the browser. Gives the redirect URL to localhost and starts the server to catch the redirect post authorization.
POST to https://login.windows.net/common/oauth2/token to get the access tokenGET to Office 365 Discovery to get the SharePoint API endpointPOST to https://login.windows.net/common/oauth2/token with update token to get a new access tokenGET to the SharePoint API endpoint to get a list of files
The script can be used with the preview API and version 1.0 of the API. It can get a list of JSON files from the preview API, but does not work with the following version 1.0 (on the last call):
{ "error": { "code": "-2147024891, System.UnauthorizedAccessException", "message": "Access denied. You do not have permission to perform this action or access this resource." } }
Does anyone see something wrong in the call sequence?
Please see the sample script for more details.
source share