Redirect page after closing the Universal Login when closable is set to true

I have 2 concerns related to the close button on the Universal Login.

  1. I set the closable = true which gives us the close button. But clicking it just gives our app a blank page but with the same login URL. When I refresh the link, I get the login form once again. What is the expected behavior for this one and what could I have been missing in the code?

  2. While there has been closed discussions about this in the past, is there maybe a new direction about being able to assign a redirect to another page after clicking the close button? or at least go back to the last page where the user was on the app before getting onto the login form? This is the past discussion on this for reference. Providing redirect to the close button when using the hosted universal login

Thanks.

Hi @tanya
The closable property in Lock was designed for the “embedded login” escenario, where you put Lock in your own application (a flow that’s not really recommended if you are building a new app).
There’s no built in way to “cancel” the login (other than closing the window or popup, or hitting the “back” button on the browser, depending on the platform).
If you wanted to get creative, you could handle the hide event from Lock and trigger a back history navigation (or window close, depending on the platform). Something like this:

    var lock = new Auth0Lock(config.clientID, config.auth0Domain, {...});

    lock.on("hide", function() {
      // navigate back 
      // https://developer.mozilla.org/en-US/docs/Web/API/History/back
      history.back();
    });
    lock.show();

I’m not sure if implementing something like this would be a good idea, though. Users won’t see this experience in other common login experiences (think Gmail, Facebook, Microsoft Account). When the browser navigates to a page you didn’t want to go, the natural reaction is to go back or close the tab/window.

1 Like