Lock 10 for Web


This document covers a deprecated version of Lock which uses endpoints that have been removed from service. It will no longer function as expected. We recommend that you migrate to Lock v11 as soon as possible.

Lock is an embeddable login form, configurable to your needs and ready for use on web apps. It enables you to easily add social identity providers to Lock, allowing your users to login seamlessly using any provider they want.

Check out the Lock repository on GitHub.

Lock 10 Installation

You can install Lock 10 via several methods. Select any of the following installation sources that best suit your environment and application.

Installation Sources

Install via npm:

npm install auth0-lock

Install via bower:

bower install auth0-lock

Include via our CDN (with the latest minor and patch release numbers from the Lock Github repository):

<script src="https://cdn.auth0.com/js/lock/10.24.3/lock.min.js"></script>

It is recommended that production applications use a specific patch version, or at the very least a specific minor version. Regardless of the method by which Lock is included, the recommendation is that the version should be locked down and only manually updated, to ensure that those updates do not adversely affect your implementation. Check the GitHub repository for a current list of releases.


If you are targeting mobile audiences, Auth0 recommends that you add the following meta tag to your application's head:

<meta name="viewport" content="width=device-width, initial-scale=1"/>

Bundling Dependencies

If you are using browserify or webpack to build your project and bundle its dependencies, after installing the auth0-lock module, you will need to bundle it with all its dependencies. Examples are available for Browserify and webpack.


1. Initializing Lock

First, you'll need to initialize a new Auth0Lock object, and provide it with your Auth0 client ID (the unique application ID for each Auth0 application app, which you can get from the management dashboard) and your Auth0 domain (for example, yourname.auth0.com).

// Initializing Auth0Lock
var lock = new Auth0Lock(

2. Authenticating and Getting User Info

Next, listen using the on method for the authenticated event. When the event occurs, use the accessToken which was received to call the getUserInfo method and acquire the user's profile information (as needed). You can also save the token or profile to localStorage for later use.

// Listening for the authenticated event
lock.on("authenticated", function(authResult) {
  // Use the token in authResult to getUserInfo() and save it to localStorage
  lock.getUserInfo(authResult.accessToken, function(error, profile) {
    if (error) {
      // Handle error

    document.getElementById('nick').textContent = profile.nickname;

    localStorage.setItem('accessToken', authResult.accessToken);
    localStorage.setItem('profile', JSON.stringify(profile));

You can then manipulate page content and display profile information to the user (for example, displaying their name in a welcome message).

 <h2>Welcome <span id="nick" class="nickname"></span></h2>

Note that if you are storing the user profile, you will want to JSON.stringify the profile object and then, when using it later, JSON.parse it, because it will need to be stored in localStorage as a string rather than a JSON object.

3. Showing Lock

Here you're showing the Lock widget after the user clicks a login button; you can just as easily show Lock automatically when arriving at a page by just using lock.show(); on page load.

This will show the Lock widget, and paired with the above, you're now ready to handle logins!

document.getElementById('btn-login').addEventListener('click', function() {

Cross-Origin Authentication

Embedding Lock within your application, rather than using Universal Login, requires cross-origin authentication. In order to use embedded Lock v10 via cross-origin authentication, you must set the oidcconformant option to true.

Browser Compatibility

Browser compatibility is ensured for Chrome, Safari, Firefox and IE >= 10. Auth0 currently uses zuul along with Saucelabs to run integration tests on each push.

More Examples

The below widget displays brief examples of implementing Auth0 in several ways: Lock as a modal "popup" widget, Lock embedded inline in a div, Lock Passwordless, a custom UI with Auth0.js, and a simple link using the API.

Next Steps

This document has shown how to use Lock 10 within a Single Page Application (SPA). Take a look at the following resources to see how Lock can be used with other kinds of web apps, or how it can be customized for your needs: