I have a client app that uses the Office 365 SharePoint preview API. Recently (as of October 2014), Microsoft published version 1.0 of that API. The authentication steps used with the preview API no longer work with version 1.0.
To demonstrate the problem I have created a short node.js script. The script does the following:
- Authorizes by launching a browser. Gives a redirect URL to localhost and launches a server to catch the redirect post-authorization
POSTtohttps://login.windows.net/common/oauth2/tokento get an access tokenGETto the Office 365 discovery service to get the SharePoint API endpointPOSTtohttps://login.windows.net/common/oauth2/tokenwith a refresh token to get a new access tokenGETto 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 is able to get a JSON list of files from the preview API, but fails with the following for 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 anybody see anything wrong with the sequence of calls?
Please take a look at the sample script for more details.