Replies: 2 comments 3 replies
-
I'm encountering the exact same issue, and have tried a combination of options, but none seem to work. @jinwood did you find out how to get this to work? |
Beta Was this translation helpful? Give feedback.
2 replies
-
We ran into this with a few providers and I think this may be the issue here too.. Although they allow you to set multiple callbackUrls, they'll always default to the first one, no matter what. Try removing your callbackUrls in the Cognito dashboard and set a different one in the first position |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Hey
I have a basic nextjs 13.4 app setup, I'm using aws cognito with next-auth and I use ngrok to provide https for local development.
I have an authOptions object
In
app/api/auth/[...nextauth]/route.ts
I have:I'm rendering a login button on my homepage:
In AWS Cognito, I have a userpool setup with integration to my app. The callback url is
https://the-ngrok-url.app/api/auth/callback/cognito
.So, as far as I can tell, everything is configured correctly in terms of cognito details like client Id, secret etc. But the callback URL defaults to
localhost:3000
and I can't work out how to explicitly set that to my ngrok url.After clicking the sign in button I'm taken to:
Network tab contains:
https://my-app.auth.eu-west-2.amazoncognito.com/error?error=redirect_mismatch&client_id=some-id
Previous request includes:
https://my-app.auth.eu-west-2.amazoncognito.com/oauth2/authorize?client_id=some-id&scope=openid&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fauth%2Fcallback%2Fcognito&state=L-R9PQ7Dmm26d_Iq8VbWuCB3dF3NrtQjipJwdcQi5rw
Is there a way to provide the redirect uri to next-auth or am I wiring this up incorrectly?
Any help greatly appreciated.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions