epilande/gatsby-theme-auth0

After login, redirect to the pre-login URL

Opened this issue · 2 comments

dandv commented

This seems like a common use case, and would be nice to have it among the batteries included:

A user views the public version of a resource, and after log in, they should stay on that page, and view any extra data for the resource that's fetched from a private API after authentication; or show additional controls based on the user's authorized role.

This sticking point was talked about in the Gatsby+Auth0 blog post, and there was no clear solution for it.

How can that be done currently with gatsby-theme-auth0?

dandv commented

Turns out this does happen automatically if I set the AUTH0_CALLBACK_URL env var to the callbackPath (at least http://localhost:8000/auth/callback/ worked, haven't tried on production yet).

If this is the right way to do it, happy to submit a PR.

@dandv Did that solution work in production?

Turns out this does happen automatically if I set the AUTH0_CALLBACK_URL env var to the callbackPath (at least http://localhost:8000/auth/callback/ worked, haven't tried on production yet).

If this is the right way to do it, happy to submit a PR.