Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

145
Vistas
Handle Email Verification Check with auth0/nextjs

I am using the library auth0/nextjs. I am trying to handle the email verification. I have access to the email_verification variable. If not verified, it will redirect to the page /please-verifiy-your-email.

At the moment I am using handleCallback method which is provided by auth0/nextjs.

Code:

const afterCallback = (req, res, session, state) => {
  if (!session.user.email_verified) {
    res.status(200).redirect('/please-verifiy-your-email')
  }

  return session;
};

export default auth0.handleAuth({
    async login(req, res) {
      try {
        await auth0.handleLogin(req, res, {
          authorizationParams: {
            audience: 'https://dev-okz2bacx.us.auth0.com/api/v2/',
            scope: 'openid profile email read:branding'
          },
          returnTo: "/dashboard"
        });
      } catch (error) {
        res.status(error.status || 400).end(error.message);
      }
    },
    async callback(req, res) {
      try {
        await auth0.handleCallback(req, res, { afterCallback });
      } catch (error) {
        res.status(error.status || 500).end(error.message);
      }
    }
});

How can I make sure, the user is still logged in, to get his email for a resend or the possibility to change his email.

He also needs the chance to do a new sign up , because when I will call api/auth/login after login with the unverified email, it will redirect automatically to /please-verifiy-your-email. I guess the session is not killed and auth0 goes back redirecting even tho I didn’t had the chance to sign up again.

Would be really cool if I get a few inputs.

It would solve the problem if I could log in the user and then it would redirect to /please-verifiy-your-email. I would be able to get his email address, name for further functions like resend verification. Right now I call api/auth/me I get:

{"error":"not_authenticated","description":"The user does not have an active session or is not authenticated"}

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda