I’m using @auth0/nextjs-auth0 library for this implementation.
While testing auth0 login for the first time, I entered an email address, then got prompted to “Authorize App” “Default app is requesting access to your … account”
I then decided that because I chose the wrong email address, I needed to go change it so I clicked “Decline”.
Now there doesn’t seem to be a way to enter a different email address. When I click the Login button again it doesn’t offer a way to register with a different address. Normally, I’d expect to see a “Not foo@bar.com? Use a different account” link. Or just send me back to the login screen.
Is there a way around this? Is it possible to set it so that any time a user click on the “Login” button they are allowed to log in again, and override whatever was there before?
Thanks!
From what I understand, Auth0 stores in a cookie your previous login credentials in AUTH0_ISSUER_BASE_URL
without cleaning it when the user declined authorization. You can see this when you check the cookies during the login screen. This is how I resolved mine. Take note of your .env variables.
// pages/api/auth/[...auth0].js
import { handleAuth, handleCallback } from "@auth0/nextjs-auth0";
const authOptions = {
async callback(req, res) {
try {
await handleCallback(req, res);
} catch (error) {
console.error("Status:", error.status, "-", error.message);
res
.redirect(
`${process.env.AUTH0_ISSUER_BASE_URL}/v2/logout?${new URLSearchParams(
{
client_id: process.env.AUTH0_CLIENT_ID,
returnTo: process.env.AUTH0_BASE_URL,
}
)}`
)
.end();
}
},
};
export default handleAuth(authOptions);
relevant: Logout handler does not call the auth0 logout endpoint if the user is unauthorized · Issue #362 · auth0/nextjs-auth0 · GitHub