php
2 TopicsSharePoint API authorization token
I am attempting to build an integration between the product the company I work for sells, and SharePoint. The purpose of the app is to create a folder or site structure based on data, and retrieve links to the files users upload to that structure so we can redirect people to them. The admin that takes care of our office365 set up the app, and I can get access tokens, but I get "Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown." or "Unsupported app only token." as a response. Here is how I am getting the token: URL: https://login.microsoftonline.com/<<tenant ID>>/oauth2/v2.0/token Headers: Content-Type: application/x-www-form-urlencoded Body (without URL encoding): client_id=<<client ID>>&scope=https://CompanyName.sharepoint.com/.default&client_secret=<<client secret>>&grant_type=client_credentials Request Type: POST Here is an example of what I am attempting to send (a request to get a list of files in a folder): URL: http://CompanyName.sharepoint.com/_api/web/GetFolderByServerRelativeUrl('/Folder1')/Files Headers: Authorization: bearer <<Access Token>> Accept: application/json;odata=verbose Request Type: GET3.8KViews1like0Comments