Auth0 Home Blog Docs

Passport-auth0: Retrieving updated user state on my Express server after email verification

Hi,

I’m using passport-auth0 for authentication in my Node / Express app. Some (but not all) of the app’s functionality requires that the user has a verified email. In order to make the user experience as seamless as possible (i.e. like an Observable), I’d like to update my client-side user object (stored as a JWT in a cookie) with the “email_verified: true” flag whenever the user verifies his/her email.

I assume that in order to do this, I need a custom redirect route for Email Verification, which I’ve set up. My question is: how can I properly retrieve the updated user profile? i.e. what goes inside this Express route:

app.get('/auth/email_verified', (req, res, next) => {
  // ???
});

Or am I even on the right track with this? Any insight or alternate working approaches would be appreciated.

Thank you!