I'm getting Your access token has expired. Please renew it before submitting the request. when I call https://graph.windows.net/myorganization/oauth2PermissionGrants?api-version=1.5 endpoint.
To prevent any stupid questions - Yes, I know that using Microsoft Graph is recommended instead of Azure AD Graph. I'm aware of it and I'm using it. But for my current case I need to request exactly Azure AD Graph.
Tests case:
- I successfully login on
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=....and getcodein the response. - I successfully exchange
codeand getaccess_tokenonhttps://login.microsoftonline.com/common/oauth2/v2.0/token. - I successfully make requests to any
Microsoft Graphendpoint (iehttps://graph.microsoft.com/education/me/classes). - I call
https://graph.windows.net/myorganization/oauth2PermissionGrants?api-version=1.5. - I get the error
Authentication_ExpiredTokenYour access token has expired. Please renew it before submitting the request. - I successfully make requests to any
Microsoft Graphendpoint, so theaccess_tokenis valid.
Based on this article: https://learn.microsoft.com/azure/active-directory/develop/active-directory-appmodel-v2-overview, I can use this access token to access both Microsoft Graph API as well as Azure AD Graph API.
So, I'm using v2.0 which should work for those: https://learn.microsoft.com/azure/active-directory/develop/active-directory-protocols-oauth-code.
What I'm doing wrong?
Thank you!