The error AADSTS700005 occurs when I try to use the Microsoft Entra ID Provider in Auth.js on Next.js v14. I have all the environment variables configured properly. I can verify this because I have manually recreated the flow using manual API requests to the microsoft endpoints with successful results. I believe it is something happening inside of the provider as I don't believe there is anything else I can configure to fix it. Below is my auth.ts file:
You can go to the reproduction url at https://temporary-issue.vercel.app/ and simply press "sign in with azure active directory" and then press sign in with entra id and continuie from there, then you will be greeted with the Auth.js error page that logs the following to the console:
error {
error: 'invalid_grant',
error_description: 'AADSTS700005: Provided Authorization Code is intended to use against other tenant, thus rejected. Trace ID: Correlation ID: Timestamp: 2024-08-14 12:03:28Z',
error_codes: [ 700005 ],
timestamp: '2024-08-14 12:03:28Z',
trace_id: '',
correlation_id: '',
error_uri: 'https://login.microsoftonline.com/error?code=700005'
}
Expected behavior
The authorization flow returns a valid auth code. Everything is successful on microsoft's end and I believe this because no error is shown until the exchange for the access token commences.
(Also Entra ID is missing from the provider selection above)
Provider type
Azure Active Directory
Environment
Windows 11 Tested on firefox and chrome
Reproduction URL
https://github.com/Wosca/temporary-issue
Describe the issue
The error AADSTS700005 occurs when I try to use the Microsoft Entra ID Provider in Auth.js on Next.js v14. I have all the environment variables configured properly. I can verify this because I have manually recreated the flow using manual API requests to the microsoft endpoints with successful results. I believe it is something happening inside of the provider as I don't believe there is anything else I can configure to fix it. Below is my auth.ts file:
How to reproduce
You can go to the reproduction url at https://temporary-issue.vercel.app/ and simply press "sign in with azure active directory" and then press sign in with entra id and continuie from there, then you will be greeted with the Auth.js error page that logs the following to the console:
Expected behavior
The authorization flow returns a valid auth code. Everything is successful on microsoft's end and I believe this because no error is shown until the exchange for the access token commences.
(Also Entra ID is missing from the provider selection above)