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!