Lock: Customizing Error Messages

This document covers an outdated version of Lock - version 9. We recommend using the latest version of the library. To do so select v10 at the dropdown. If you are already using v9 but interested in upgrading, take a look at the Lock 9 to Lock 10 migration guide.

You can customize the error messages that will be displayed on certain situations by providing a dict option at the customization options. A full listing of available dict fields to customize can be found in the GitHub repository's English Dictionary file for Lock 9. Below is an example of some customized error messages:

// Initialize the Auth0Lock instance
var lock = new Auth0Lock('YOUR_CLIENT_ID', 'YOUR_AUTH0_DOMAIN');

// Customize your error messages in a dictionary
var dict = {
        loadingTitle:   'loading...',
        close:          'close',
        signin: {
            wrongEmailPasswordErrorText: 'Custom error message for invalid user/pass.',
            serverErrorText: 'There was an error processing the sign in.',
            strategyEmailInvalid: 'The email is invalid.',
            strategyDomainInvalid: 'The domain {domain} has not been setup.'
        },
        signup: {
            serverErrorText: 'There was an error processing the sign up.',
            enterpriseEmailWarningText: 'This domain {domain} has been configured for Single Sign On and you can\'t create an account. Try signing in instead.'
        },
        reset: {
            serverErrorText: 'There was an error processing the reset password.'
        }
        // wrongEmailPasswordErrorText, serverErrorText, enterpriseEmailWarningText are used only if you have a Database connection
        // strategyEmailInvalid is shown if the email is not valid
        // strategyDomainInvalid is shown if the email does not have a matching enterprise connection
    }
};

// Invoke the lock show method with the customized dictionary
lock.show({ dict: dict });

These errors will be shown on the widget header:

Widget Header Errors