Hi @Rodolfo Carlos Gonzalez Herrera,
Thank you for reaching out to Microsoft Q&A forum!
The “InvalidAuthenticationToken” error typically occurs when the API audience of your access token doesn’t match the API endpoint you’re calling. Here are some steps to troubleshoot this issue:
Check the Resource Parameter:
- In your login request, ensure that the
resource
parameter is set to[graph.microsoft.com](https://graph.microsoft.com)
.- If you’re using the v2 endpoint, consider getting the token from the v2 endpoint by calling this URL.
- **Recommended**: Change the application signature algorithm to RS256 instead of HS256. - [Also, modify the ](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token)**[`responseType`](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token)**[ parameter to include ](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token)**[`token id_token`](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token)**[ (instead of the default) to receive an access token in the response](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token)[1](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token). **Verify Permissions and Token Creation**: - Ensure that your app has the necessary permissions (e.g., **`Mail.Read`**) in the Azure portal. - Double-check the token creation process for any typos or incorrect permissions. - [Consider token revocation as a potential cause](https://stackoverflow.com/questions/37885476/ms-graph-api-invalid-authentication-token)[2](https://devcodef1.com/news/1154910/invalid-authentication-token-in-azure-ai-studio).
Remember to adjust the parameters and endpoints according to your specific use case