How to return to the original web page after logging in with Auth0

How to return to the original web page after logging in with Auth0

Hi @hisazumi,

Welcome to the Auth0 Community!

I recommend specifying your Login page URL as the redirect_uri of your /authorize request, and please make sure that you have included it under the list of Allowed Callback URLs in your Application settings.

Please check out our Redirect Users documentation to learn more.

Thanks,
Rueben

Can I use Actions to return to the original page after logging in?

Hi @hisazumi,

Unfortunately, no, using a Post-Login Action will not be the right approach for returning the user to the “original” page after login, because the Action script executes before issuing an access token and sending the user to the Callback URL.


(Ref: Login Flow)

In other words, the user’s final destination after a successful login is the Callback URL defined on your app.

For example, if your app’s original page is https://myexampleapp.com, then you would need to add that URL to your Application’s Settings Allowed Callback URLs and make a request like the following:

https://YOUR_DOMAIN/authorize?
    response_type=code&
    client_id=YOUR_CLIENT_ID&
    redirect_uri=https://myexampleapp.com&
    scope={scope}&
    audience={apiAudience}&
    state={state}

The redirect_ur needs to point to your original home page URL for the user to return to that page after logging in successfully.

I hope the clarification helps!

Please let me know how this goes for you.

Thanks,
Rueben

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