Customize a callback path for withPageAuthRequired()

Hello!

I’m using SDK auth0/nextjs-auth0 ^1.7.0 in a nextjs app. We’re using withPageAuthRequired() to redirect unauthenticated visitors to the auth0 login dialog box. The auth0 login callback is '/api/auth/callback'.

We are trying out two implementations, one for regular login and one for login to organizations. We have two callbacks:

'/api/auth/callback'
'/api/auth/orgs/callback'

Is possible to customize a callback path for withPageAuthRequired() redirect? I found a doc for WithPageAuthRequiredOptions and a returnTo path. Trying to find something similar, or a config somewhere, for a callback path. Any ideas? Thanks!

1 Like

Hey @illusionfactory,

I was looking for the exact same thing and found that you could change it with the environment variable AUTH0_CALLBACK in the source code here. Not entirely sure how to use more than one callback path for different implementations for your case but at least this is something you could
tweak around.