Auth0 Home Blog Docs

Auth0.js returnTo getting ignored - always using the first URL from client settings

logout
auth0-js
returnto

#1

We are facing the following issue with Auth0.js auth0-js@8.10.1.

Regardless of what we specify as returnTo URL, after doing logout, we are always redirected to the FIRST specified allowed logout URLs in the client settings page.
This prevent us from using both dev and prod environments at the same time.

If we debug the webauth object in JS console, it has the correct value.

![alt text][1]

Login callback URL’s also work properly. The system works if we change the order in the client settings page, depending on what environment we want to work with, but as stated, we need to use both simultaneously.

![alt text][2]

Attached screenshot of settings and console log.


#2

Based on the information provided you’re not providing the returnTo parameter in the adequate place. In particular, the screenshot shows returnTo as an option passed when initializing the Auth0.js instance and according to the documentation you need to pass this parameter as part of the call to the logout method.

I performed a test with code similar to the following and the provided URL in the logout call was respected:

webAuth.logout({
    returnTo: "[specific_logout_url]",
    client_id: "[client_identifier"]
});

Finally you mention that you’re using this to be able to call a specific URL depending on the environment (development vs productions), however, the recommended approach for such a situation would be to have completely different tenant/domains; for more information see: https://auth0.com/docs/dev-lifecycle/setting-up-env


#3

doh!

thanks, that was the problem.

cheers


#4