Auth0 NextJS invalid_grant (Failed to verify code verifier)

Hi! I’m facing an issue on my local NextJS app that when I open multiple localhost:3000 and navigate to the universal login of auth0, only the latest one works and all the others fail with the following error:

CallbackHandlerError: Callback handler failed. CAUSE: invalid_grant (Failed to verify code verifier)

I think the issue here is in the way the auth0/nextjs module works because by navigating to the universal login the cookie auth_verification is saved to my app and when navigating to a second universal login, the old cookie is being overwritten with the new one, resulting in error with every older login in my browser.

I even tried to reproduce it with the auth0/nextjs sample app and a fresh tenant but with the same results. As of now I can’t think of a way to fix this and I’m really considering switching the auth provider, because switching the framework isn’t an option here.

Any help or suggestions would be highly appreciated, thanks so much in advance!

1 Like