https://next-auth.js.org/errors#oauth_callback_error {
statusCode: 400,
data: `{"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'code'.\\r\\nTrace ID: aeab5bc3-a613-456c-a373-d7b54a881000\\r\\nCorrelation ID: 1b8a84ad-0842-4c60-837d-827b85098a3b\\r\\nTimestamp: 2021-03-31 11:17:20Z","error_codes":[900144],"timestamp":"2021-03-31 11:17:20Z","trace_id":"aeab5bc3-a613-456c-a373-d7b54a881000","correlation_id":"1b8a84ad-0842-4c60-837d-827b85098a3b","error_uri":"https://login.microsoftonline.com/error?code=900144"}`
Any advice ?
This error message wasn't the relevant one, it only was a consequence of authentication failing because of a different issue.
My app wasn't properly set up with Azure and Microsoft sent an error message back to our callback endpoint. I only noticed this by looking at Chrome's network debug. I have no idea where we can catch this error message in NextAuth, if somebody knows how, I wouldn't mind catching and logging these.
PS: for the curious, my actual problem was that I did not set the "audience" properly to use the 'common' endpoints. In the manifest, I had "signInAudience": "PersonalMicrosoftAccount",
when I should have had "signInAudience": "AzureADandPersonalMicrosoftAccount",
This error message wasn't the relevant one, it only was a consequence of authentication failing because of a different issue.
My app wasn't properly set up with Azure and Microsoft sent an error message back to our callback endpoint. I only noticed this by looking at Chrome's network debug. I have no idea where we can catch this error message in NextAuth, if somebody knows how, I wouldn't mind catching and logging these.
PS: for the curious, my actual problem was that I did not set the "audience" properly to use the 'common' endpoints. In the manifest, I had "signInAudience": "PersonalMicrosoftAccount",
when I should have had "signInAudience": "AzureADandPersonalMicrosoftAccount",