Sharepoint OAuth2.0 API Access

Copper Contributor

I created the API in share-point and saved all XML permission to the app, however I am getting the error code  "-2147024891, System.UnauthorizedAccessException", I am able to get the access token. When passing the access token to the share-point API it is throwing the above mentioned error.

Alternatively I tried to create the app in AzureAD and grant all the permission to the share-point App, and when getting the access token and while passing the access token to the share-point API it is throwing me the error code : "{"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}",



Do anyone has the fix how resolve this error. I

1 Reply

@StepByStepCode20 

 

It seems that something could be wrong how you get access token using Client Id and Secret key in both the approach

 

Please share below details for first approach which you have used 

  • How you are getting access token from Client Id and Secret Key - you can share code as well
  • Which XML you have used for permission?
  • Which SharePoint API and How you are trying to call it?