# How to configure Auth0 application to redirect to a specific URL after login?

**URL:** <https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544>\
**Category:** Get Help\
**Tags:** settings, auth0, login\
**Created:** [August 28, 2022, 6:44pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544 "2022-08-28T18:44:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![greggs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/greggs/32/33670_2.png) [@greggs](https://community.auth0.com/u/greggs)\
**Post date:** [August 28, 2022, 6:44pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/1 "2022-08-28T18:44:23Z")

</div>

Hello all,  
I would like to understand how I can configure my Auth0 application settings to allow me to redirect to a particular route. Using localhost as an example URL, I am successful at getting the login to work. For example, my application URIs are:

- **Allowed Callback URLs:** `http://localhost:3000/callback, http://localhost:3000`
- **Allowed Logout URLs:** `http://localhost:3000`
- **Allowed Web Origins:** `http://localhost:3000`

How can I update this correctly to use `http://localhost:3000/app/` instead?

Thank you.  
Gregg

---

<div class="post-metadata">

**Author:** ![SaqibHussain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saqibhussain/32/42924_2.png) [@SaqibHussain](https://community.auth0.com/u/SaqibHussain)\
**Post date:** [August 29, 2022, 4:13pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/2 "2022-08-29T16:13:09Z")

</div>

Hi @greggs

Welcome to the Auth0 Community, it’s great to have you on board.

You could create a post login Action to do the redirect as per this document [https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions#start-a-redirect](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions#start-a-redirect)

So for you it might look like this

```auto
exports.onExecutePostLogin = async (event, api) => {
  api.redirect.sendUserTo("http://localhost:3000/app");
};

```

Does this work for you?

Warm regards.

---

<div class="post-metadata">

**Author:** ![greggs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/greggs/32/33670_2.png) [@greggs](https://community.auth0.com/u/greggs)\
**Post date:** [August 29, 2022, 5:12pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/3 "2022-08-29T17:12:57Z")

</div>

This works great. I want to preserve the access to the user object that is provided by OAuth login. In this case, it sounds like I need to pass that information along as well. And to do that, I would need to follow the example on the same page of the documentation you provided.

> **[Redirect with Actions](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions#pass-data-to-the-external-site)**
>
> Learn how to use post-login Actions to redirect users before an authentication transaction is complete.

I believe this will satisfy my goal. Thank you.

---

<div class="post-metadata">

**Author:** ![SaqibHussain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saqibhussain/32/42924_2.png) [@SaqibHussain](https://community.auth0.com/u/SaqibHussain)\
**Post date:** [August 29, 2022, 6:37pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/4 "2022-08-29T18:37:40Z")

</div>

That’s great @greggs

Indeed this is one option, what Auth0 SDK are you using? some SDK’s have functionality to redirect after login.

---

<div class="post-metadata">

**Author:** ![greggs](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/greggs/32/33670_2.png) [@greggs](https://community.auth0.com/u/greggs)\
**Post date:** [August 29, 2022, 8:17pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/5 "2022-08-29T20:17:46Z")

</div>

For my node application I am currently using the [express-openid-connect](https://www.npmjs.com/package/express-openid-connect) module. The version # is `2.8.0`.

Within the actions, if we can reference the SDK, I am fine with the latest version. Does this help? It’d be great if there was an easier way to implement this.

Thank you for your guidance!

---

<div class="post-metadata">

**Author:** ![SaqibHussain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/saqibhussain/32/42924_2.png) [@SaqibHussain](https://community.auth0.com/u/SaqibHussain)\
**Post date:** [August 31, 2022, 6:40am UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/6 "2022-08-31T06:40:03Z")

</div>

Hi @greggs

If you’re using our node SDK, the easiest thing to do might be to use the returnTo (the URL to return to after login) login option like this:

```auto
app.get('/login', (req, res) => res.oidc.login({ returnTo: '/app' }));

```

This is documented here [https://auth0.github.io/express-openid-connect/interfaces/loginoptions.html](https://auth0.github.io/express-openid-connect/interfaces/loginoptions.html)

Some examples here [https://github.com/auth0/express-openid-connect/blob/master/examples/custom-routes.js](https://github.com/auth0/express-openid-connect/blob/master/examples/custom-routes.js)

I hope this helps.

Warm regards

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 14, 2024, 10:12pm UTC](https://community.auth0.com/t/how-to-configure-auth0-application-to-redirect-to-a-specific-url-after-login/89544/7 "2024-05-14T22:12:18Z")

</div>

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