Migrate SPAs Using Lock 9 Popup Mode to Universal Login

This document explains how to migrate Web Applications using Lock to Universal Login. For other migration scenarios see Migrating from Embedded to Universal Login.

When you use 'popup mode' in Lock 9 applications, the entire authentication flow happens in a web page, without any kind of redirection. That will change when you use Universal Login.

  1. Initialize Lock:
var lock = new Auth0Lock('YOUR_CLIENT_ID', 'YOUR_AUTH0_DOMAIN');
  1. Show lock specifying responseType: token when a login is required, and a callback function that will be called after authentication transaction finishes:
function login()
            responseType : "token",
            authParams: {
                scope: 'openid email offline_access'
        function (err, profile, id_token) {
            if (!err) {
                setSession(profile, id_token);
                lock.getProfile(hash.id_token, function(err, userInfo) {
                    if (!err) {
                        /// use the userInfo

To use Universal Login, you need to use auth0.js to manage the authentication flow:

  1. Initialize auth0.js, using the same parameters as when initializing Lock and also including the ones you use when you call lock.show().
var webAuth = new auth0.WebAuth({
  domain: 'YOUR_AUTH0_DOMAIN',
  clientID: 'YOUR_CLIENT_ID',
  responseType: 'token id_token',
  scope: 'openid',
  redirectUri: 'https://YOUR_APP/callback'
  1. Redirect to the /authorize endpoint when you need to log the user in your application.
function login() {
  1. Call parseHash to retrieve the authentication results, when the page loads, after being redirected to your callback page:
webAuth.parseHash(function(err, authResult) {
  if (authResult && authResult.accessToken && authResult.idToken) {
    setSession(authResult.idTokenPayload, authResult.idToken, authResult.accessToken);
  } else if (err) {
    // handle errors
  1. Review if you are using any legacy authentication flow in your application, and adjust your code accordingly.

You can find complete examples of implementing Universal Login in Single Page Applications for different technologies in our Quickstarts.

Customizing the Login Page

When you integrate Universal Login in your application, you redirect the user to the /authorize endpoint of your Auth0 tenant. If Auth0 needs to authenticate the user, it will show the default login page.

You can customize the login page in your Dashboard under Hosted Pages, by enabling the Customize Login Page toggle.

Login Page

Customize Lock in the Login Page

The default login page for Universal Login with your tenant is a template that will use Lock to provide your users with an attractive interface and smooth authentication process. You can look over that template and use it as a starting point if you choose to customize it in any way.

If you want to change any of Lock's configurable options, you can do so using the editor Dashboard under Hosted Pages. These options can alter the behavior of Lock itself, or the look and feel of the widget using the theming options. See the configuration documentation for details on how to customize Lock.

When you're done making changes to the code, click Save to persist the changes.

Login Page