Closed zluo01 closed 3 weeks ago
See here, this can solve the error of authjs signin redirect failure in server form action.
export const signInWithGithubAction = validatedAction(
signInWithGithubSchema,
async (data, formData) => {
const { redirect: redirectParma } = data
const res = await signIn('github', {
redirect: !!redirectParma,
redirectTo: redirectParma ? redirectParma : undefined,
})
redirect(res)
},
)
Key Points: redirect(res)
at the fuction last.
fucking authjs , get up and work , I spent 3 hours on this,
Provider type
Cognito
Environment
Reproduction URL
https://github.com/zluo01/next-auth-cognito
Describe the issue
Login with cognito will get following error
error=redirect_mismatch
from the cognito url. Cognito page showsAn error was encountered with the requested page.
.Only change I have made is create
.env.local
and clean upauth.js
with one provider compare to the originalnext-auth-example
.Callback on cognito end is
http://localhost:3000/api/auth/callback/cognito
as suggested inhttps://authjs.dev/getting-started/authentication/oauth
.How to reproduce
Fill in the blank in
.env.local
then simply try to login with cognito.Expected behavior
Successfully authenticate with cognito like V4.