# Logout with redirectTo passes to wrong URL from Allowed Logout URLs

**URL:** <https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494>\
**Category:** Get Help\
**Tags:** logout\
**Created:** [November 29, 2018, 12:28pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494 "2018-11-29T12:28:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![evgeny](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@evgeny](https://community.auth0.com/u/evgeny)\
**Post date:** [November 29, 2018, 12:28pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/1 "2018-11-29T12:28:38Z")

</div>

Hi!  
I tried to logout with redirect (Laravel 5.7):

> `$logoutUrl = sprintf(
> ‘https://%s/v2/logout?redirectTo=%s&client_id=%s’,
> env(‘AUTH0_DOMAIN’),
> urlencode(env(‘APP_URL’).‘/pre_login’),
> env(‘AUTH0_CLIENT_ID’));
> return \Redirect::intended( $logoutUrl);`

The URL is also mentioned in **Allowed Logout URLs** after one URLs used for development (they are completely different and comma-separated as described in docs).

Code in both applications is same, excepts data from env files.

My problem is - when I tried to logout using the code above - I was redirected to first URL from **Allowed Logout URLs** and it’s disappointing

So, is that my problem and I need to seek in my code for redirects normal behavior or I need to change something in application setting on `auth0` side?

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [November 29, 2018, 1:16pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/2 "2018-11-29T13:16:17Z")

</div>

Can you share the exact logout URL that the browser requests, and the `302` response returned by Auth0? (You can see this in the browser’s network tab in the developer tools)

---

<div class="post-metadata">

**Author:** ![evgeny](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@evgeny](https://community.auth0.com/u/evgeny)\
**Post date:** [November 29, 2018, 2:23pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/3 "2018-11-29T14:23:10Z")

</div>

Thanks for fast answer!!!  
Sure.

> Logout URL that the browser requests  
> is: [https://evinlort.eu.auth0.com/v2/logout?redirectTo=localhost%2Fwallter%2Fwallter%2Fpublic\_html%2Fpre\_login&client\_id=pSsbQyNPgKmUFFLIUcwpq1Wm8TZyJAJY](https://evinlort.eu.auth0.com/v2/logout?redirectTo=localhost%2Fwallter%2Fwallter%2Fpublic_html%2Fpre_login&client_id=pSsbQyNPgKmUFFLIUcwpq1Wm8TZyJAJY)

URLs in **Allowed Logout URLs** are (as they present there):  
[https://crm-tst.wallter.com/pre\_login](https://crm-tst.wallter.com/pre_login), [http://localhost/wallter/wallter/public\_html/pre\_login](http://localhost/wallter/wallter/public_html/pre_login)

> Network tab in the developer tools

 ![Screenshot%20from%202018-11-29%2016-17-08](https://global.discourse-cdn.com/auth0/original/2X/9/9b62a5edd4624ce5c81851284a43c80b9f51c342.png)  
Detailed:

1. Logout (local)  

2. Logout (auth0)  

3. Pre\_login (my custom page. Must be local, but it redirected to remote app (not localhost))  

If you need more info, I’m all yours 🙂

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [November 29, 2018, 4:25pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/4 "2018-11-29T16:25:06Z")

</div>

It looks as if you are using `redirectTo` as the parameter to indicate the return URL, but the parameter name should be `returnTo`.  
Sorry I missed that in the original code snippet.

---

<div class="post-metadata">

**Author:** ![evgeny](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@evgeny](https://community.auth0.com/u/evgeny)\
**Post date:** [December 2, 2018, 8:03am UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/5 "2018-12-02T08:03:59Z")

</div>

> [@nicolas\_sabena](#):
>
> redirectTo

Thank you Nicolas!  
As I saw - all my troubles was my inattention to little things, such as returnTo and redirectTo.

Thanks again!

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [December 2, 2018, 12:48pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/6 "2018-12-02T12:48:10Z")

</div>

Happens to all of us! 😃

---

<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:** [January 1, 2019, 12:48pm UTC](https://community.auth0.com/t/logout-with-redirectto-passes-to-wrong-url-from-allowed-logout-urls/18494/7 "2019-01-01T12:48:13Z")

</div>

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