I am creating an Angular 7 single page application and I am using Auth0 to log in. When the user clicks logout in my application I want the user to be logged out of the auth0 server and then redirect back to auth0 login page.
The tutorial I am currently following suggests that I should redirect back to a component in my application with a login button, and from there the user clicks log in and it sends me to the auth0 login page.
I understand I should be doing something like what I have below.
Hi there @spmtest, as described in our Logout documentation, you redirect the user after a successful logout. Here is a excerpt from that documentation below:
To redirect a user after logout, add a returnTo querystring parameter with the target URL as the value. We suggest that you encode the target URL being passed in. For example, to redirect the user to http://www.example.com after logout, you can make the following request:
you must add the returnTo URL (for example http://www.example.com ) to the Allowed Logout URLs list in the Settings tab of your Auth0 app that is associated with the specified CLIENT_ID . See Set the Allowed Logout URLs at the Application Level for more information.
However if by chance I am misunderstanding your desired result please let me know as I am happy to help! Thanks!
James can probably better answer this than I can, but I believe redirecting back to the hosted login page (which seems to be what you are demonstrating) is a bad idea. The hosted login page URL has a state parameter, and that parameter is time limited. After a while the URL becomes invalid and the user will get an error if they try logging in.