Customize Classic Universal Login Pages with Lock or SDK

Customize Classic Universal Login Pages with Lock or SDK

When adding Auth0 to your web apps, the best solution is to use Auth0's Universal Login. If you plan to use the New Experience, you won't even need to choose an Auth0 library to use inside of the login page, and can stop here. If you are using the Classic Experience, this guide will help you choose a technology to power your login page.

Universal Login is less complex than embedding the authentication process within your app. It also prevents the dangers of cross-origin authentication.

The Classic login page uses the Lock Widget by default for user authentication. It also has templates for Lock in Passwordless Mode and for a custom UI built with the Auth0.js SDK.

  • Lock for Web, Auth0's drop-in login and signup widget

  • The Auth0 SDK for Web with your custom designed interface

  • Or, a custom user interface that you have created which directly ties into the Authentication API.

Lock is a drop-in authentication widget that provides a standard set of behaviors and a customizable user interface.

Auth0 SDKs are client-side libraries that do not come with a user interface but allow for expanded customization of the behavior and appearance of the login page.

The Authentication API provides integration without requiring the use of Auth0 SDKs. The best option to choose will depend on the needs of your app.

Below is a quick overview of reasons you might want to use Lock, versus using an Auth0 SDK or the authentication API. There are details about each option (Lock, Auth0 SDKs, Authentication API) below the table, to assist you in finding the right way to implement Auth0 in your application!

Lock

Lock is a login form that makes it easy for your users to authenticate using a selected connection. Lock will automatically handle most of the details involved in creating and authenticating users. Lock is provided as a drop-in solution for the Classic Universal Login experience.

With Lock, you will be implementing a UI that:

  • Is robust and provides an excellent user experience on any device with any resolution

  • Has a simple design that fits in with most websites with just a few tweaks to its custom color

  • Adapts to your configuration, displaying the appropriate form controls for each available connection and only those which are allowed (such as sign up or password reset)

  • Selects the correct connection automatically. You may specify a desired default behavior for ambiguous cases

  • Remembers the last used connection for a given user

  • Automatically accommodates internationalization

  • Provides instant password policy checking at sign up

Although you cannot alter Lock's behavior significantly, you can configure several basic options to make Lock look and behave differently.

Consider using Lock if:

  • You like the structure, look, and feel of Lock

  • You prefer a quicker and easier implementation of Auth0 and a ready-made responsive UI

  • Your process includes many of the use cases that Lock handles out of the box:

    • Enterprise logins

    • Databases with password policies

    • User signup and password reset

    • Authentication using social providers

    • Avatars

Sample Login Customization Scripts

To customize the Classic Login Page, navigate to your Auth0 Dashboard.

Choose Branding > Universal Login > Advanced Options and ensure you are using the Classic login page. Save any changes you make.

Navigate to the Login tab and turn on the Customize Login Page selection. In the HTML tab, click the Default Template drop-down and select Lock.

The example script below customizes the logo for each application, or you can set a default logo. The minimum recommended resolution is 200 pixels (width) by 200 pixels (height). Add the logouturl configuration to the <scripts> block:

var logourl = "https://example.com/defaultlogo1.png"; //set default logo
if(config.clientID === "HUXwC72R3qr9JJo9ImPsdzJbtY8aD5kS")
{
    logourl = "https://example.com/defaultlogo2.png";
}
theme: {
    logo: logourl,
    primaryColor: colors.primary ? colors.primary : 'green'
},

Was this helpful?

/

Customize the signup terms

The example below customizes the signup terms for your application. You can add custom language to display when users signup.

var languageDictionary;

languageDictionary = {
    signUpTerms: "I agree to the <a href='https://my-app-url.com/terms' target='_blank'>terms of service</a> and <a href='https://my-app-url.com/privacy' target='_blank'>privacy policy</a>."
};

Was this helpful?

/

Custom user interface

If the requirements of your app cannot be met by the standardized behavior of Lock, or if you have a complex custom authentication process, a custom user interface is needed. You also might prefer this option if you already have a user interface which you would prefer to keep.

With Auth0's library for Web, you can customize the behavior and flow of the process used to trigger signup and authentication. You can also directly use the Authentication API, without any wrapper at all, if you so choose.

Unlike with Lock, neither of these options includes a user interface. You will have complete control over the user experience for signup and authentication flow, and for the UI aspects of layout, look and feel, branding, internationalization, RTL support, and more.

Consider implementing a custom user interface in conjunction with an Auth0 library or the Authentication API for your app if:

  • You have strict requirements for the appearance of the user interface

  • You have strict requirements for file sizes - the Auth0 libraries are significantly smaller than Lock, and if you instead choose to deal with the API directly, that would not require any additional weight.

  • You are comfortable with HTML, CSS, and JavaScript - you'll be creating your own UI

  • You only need to handle username/password and social provider authentication

  • You have multiple database or Active Directory Connections

You can also see specific examples of the usage of both Lock and Auth0 SDKs for a wide variety of programming languages and platforms in our Quickstarts. These guides may further assist you in your decision about which to use for your specific app needs.

Learn more