Search code examples
microsoft-graph-apionedrive

Onedrive Authentication


Me and my team are developing an API to secure files,in that API we need Onedrive(cloud storage).we integrated Onedrive using MicrosoftGraph authentication as shown in the below link. enter link description here

The thing is when i try to authenticate and sign in to pesonal account it works but for organisation account i'm facing the issue as shown in the below

We have recieved a bad request.****(AADSTS165000: Invalid Request: The request tokens do not match the user context. Do not copy the user context values (cookies; form fields; headers) between different requests or user sessions; always maintain the ALL of the supplied values across a complete single user flow. Failure Reasons:[Token values do not match;])****

pls help me technically.


Solution

  • Your token does not match the user context. This is because although you are logged in to your organization account, the token you use is still issued by your personal account.

    The access token is unique. If you need to log in with an organization account, then you must set the organization account as the token issuer. You need to log in with your organization account to obtain a new authorization code, and then use the authorization code to obtain the token again.