I'm using nextjs 12.1.6
, nextauth ^4.5.0
, cognito
to create social sign ins. After successful sign in on the cognito Hosted UI
, I get redirected to my nextjs app with this error in the url api/auth/signin?error=OAuthCallback
. I'm not sure what the problem is. Here is the log I get:
NextAuth + AWS Cognito - message: 'nonce mismatch, expected undefined, got:
Asked Answered
Please make sure to post code and errors as text directly to the question (and not as images), and format them appropriately. –
Koumis
Related GH discussion: github.com/nextauthjs/next-auth/discussions/3551. –
Koumis
I have been able to get this to work by using the following code:
providers: [
CognitoProvider({
clientId: process.env.COGNITO_CLIENT_ID,
clientSecret: process.env.COGNITO_CLIENT_SECRET,
issuer: process.env.COGNITO_ISSUER,
checks: ['nonce']
})
]
This is with:
"next": "^14.1.4",
"next-auth": "^4.24.5",
Had a similar problem,
checks: ['nonce']
did the trick. –
Adamite © 2022 - 2024 — McMap. All rights reserved.