Access to Email before handleLogin is called

I am using the nextjs-auth0 SDK and would like to add some logic before the handleLogin is called. I have my auth0 API endpoints set up like so:

import { handleAuth, handleLogout, handleLogin } from '@auth0/nextjs-auth0';

export default handleAuth({
  signout: handleLogout({
    returnTo: `${process.env.AUTH0_BASE_URL}?status=verify-email`,
  }),
  login: async (request, response) => {
    try {
      await handleLogin(request, response, {
        returnTo: '/home',
      })
    } catch (e) {
      
    }
  },
  loginEs: async (request, response) => {
    try {
      await handleLogin(request, response, {
        authorizationParams: {
          ui_locales: 'es',
        },
        returnTo: '/es/home',
      })
    } catch(e) {

    }
  }
});

Ideally I would add some logic before the handleLogin is called in the login endpoint, is there any way to access the email of the logging in user at this point?

Thanks!

Hi @mavendark,

Welcome to the Auth0 Community!

This method redirects the user to the login prompt before they have submitted an email address. I don’t think it would be possible to know the user’s email at this point.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.