options
parameter sent to the constructor. These options can alter the way that the Lock widget behaves, how it deals with connections, additional signup fields that you require for your project, the language and text values, colors, and images on the widget, and many more. Take a look at the index below if you know what you are looking for, or browse the options for more details.
Option | Description |
---|---|
allowAutocomplete | Enable or disable autocompletion on the email or username inputs |
allowPasswordAutocomplete | Enable or disable autocompletion on password input |
allowShowPassword | Specifies if the user can choose to show password while typing it |
allowedConnections | List of connections that will be available to perform authentication |
autoclose | Specifies if Lock closes after a login |
autofocus | Specifies if focus is set on the first input field |
avatar | Specifies if an avatar and a username should be displayed on the Lock’s header once an email or username has been entered and how to obtain it |
closable | Determines whether or not Lock can be closed |
container | The HTML element where Lock will be rendered. This causes Lock to appear inline instead of in a modal window |
flashMessage | Shows an error or success flash message when Lock is shown |
language | Specifies the language of the widget |
languageDictionary | Customize text used for widget elements (such as labels and placeholders) |
popupOptions | Customize the location of the popup in the screen |
rememberLastLogin | Whether or not to show a screen that allows you to quickly log in with the account you used the last time |
scrollGlobalMessagesIntoView | Specify if a globalMessage should be scrolled into the user’s viewport |
theme
property of the options
object.
Option | Description |
---|---|
authButtons | Customize the appearance of specific connection buttons |
labeledSubmitButton | whether or not the submit button has text |
logo | What logo should be used |
primaryColor | Color of the primary button on the widget |
auth
property of the options
object.
Option | Description |
---|---|
audience | The API which will be consuming your |
autoParseHash | Whether or not to automatically parse hash and continue |
connectionScopes | Specify connection |
params | Option to send parameters at login |
redirect | Whether or not to use redirect mode |
redirectUrl | The URL to redirect to after auth |
responseMode | Option to send response as POST |
responseType | Response as a code or token |
sso | Determines whether Single Sign-On is enabled or not in Lock |
Option | Description |
---|---|
additionalSignUpFields | Additional fields collected at signup |
allowLogin | Whether or not to allow login on widget |
allowForgotPassword | Whether or not to allow forgot password on widget |
allowSignUp | Whether or not to allow signup on widget |
defaultDatabaseConnection | Default shown DB connection |
initialScreen | Which screen to show when the widget is opened |
loginAfterSignUp | After signup, whether or not to auto login |
forgotPasswordLink | Link to a custom forgot password page |
showTerms | Specify if signup terms should be display |
mustAcceptTerms | Whether or not terms must be accepted (checkbox) |
prefill | Prefill values for email/username fields |
signUpLink | Set a custom url to fire when clicking “sign up” |
usernameStyle | Limit username field to accept only “username” values or only “email” values |
Option | Description |
---|---|
defaultEnterpriseConnection | Specifies a connection if more than one present |
Option | Description |
---|---|
passwordlessMethod | When using Auth0LockPasswordless with an email connection, you can use this option to pick between sending a code or a magic link to authenticate the user |
Option | Description |
---|---|
configurationBaseUrl | Override your application’s base URL |
languageBaseUrl | Override your language file base URL |
hashCleanup | Override the default removal of the hash from the URL |
connectionResolver | Optional callback function for choosing a connection based on the username information |
<input autocomplete />
). Defaults to false
.
allowAutocomplete: true
<input autocomplete />
). Defaults to false
.
Set allowPasswordAutocomplete
to true
for password manager support and to avoid other cases of adverse behavior.
allowPasswordAutocomplete: true
false
.
allowShowPassword: true
Lock with allowShowPassword
set to true
and toggled to show the password:
signin|signup|reset
actions. Defaults to all enabled connections.
allowedConnections: ['Username-Password-Authentication']
allowedConnections: ['twitter', 'facebook', 'linkedin']
allowedConnections: ['qraftlabs.com']
Examples of allowedConnections
:
closable
it won’t be closed, even if this option is set to true.
autoclose: true
false
when being rendered on a mobile device, or if a container
option is provided; defaults to true
in all other cases.
autofocus: false
avatar
option.
null
.
avatar: null
Default behavior with Gravatar:
container
option is provided its value is always false
, otherwise it defaults to true
.
closable: false
id
of the html element where the widget will be shown.
This makes the widget appear inline within your div
instead of in a modal pop-out window.
error
or success
flash message when Lock is shown. This object has the following properties:
error
, info
, and success
language: 'es'
languageDictionary
values able to be altered with this object.
languageDictionary
option.
window.open
features. This only applies if redirect
is set to false
.
true
. This information comes from the user’s Auth0 session, so this ability will last as long as their Auth0 session would (which is configurable).
rememberLastLogin: false
New tenants automatically have Seamless SSO enabled. With this enabled, the rememberLastLogin
option will not be relevant because if there is a session in place then the page will not be displayed at all. Using Seamless SSO is highly recommended because it provides a seamless authentication experience: users log in once and won’t have to enter credentials again when they navigate either through the applications you have built, or third party apps. If the user is not logged in they will be redirected to the login screen, as expected. Additionally, the Last time you signed in with message will not be available under the following circumstances:
responseType: code
(indicating the Authorization Code Flow, which is used for Regular Web Apps).globalMessage
should be scrolled into the user’s viewport. Defaults to true
.
scrollGlobalMessagesIntoView: false
theme
property of the options
object.
LOGIN WITH MYCONNECTION
for login).#eb5424
.#FFFFFF
.http://site.com/logo.png
.true
. When set to false
, an icon will be shown instead.
logo
is a URL for an image that will be placed in the Lock’s header, and defaults to Auth0’s logo. It has a recommended max height of 58px
for a better user experience.
primaryColor
property defines the primary color of the Lock; all colors used in the widget will be calculated from it. This option is useful when providing a custom logo
, to ensure all colors go well together with the logo
’s color palette. Defaults to #ea5323
.
auth
property of the options
object.
The default scope used by Lock is openid profile email
.
audience
option indicates the API which will be consuming the that is received after authentication.
autoParseHash
is set to true
, Lock will parse the window.location.hash
string when instantiated. If set to false
, you’ll have to manually resume authentication using the resumeAuth method.
state
parameter with a value equal to foo
and also adds a scope
parameter (which includes the scope, and then the requested attributes).
redirectUrl
is provided (set to non blank value) the responseType
option will be defaulted to code
if not manually set.
"form_post"
if you want the code or the token to be transmitted via an HTTP POST request to the redirectUrl
, instead of being included in its query or fragment parts.
Otherwise, this option should be omitted, and is omitted by default.
responseType
should be set to “token” for Single-Page Applications, and “code” otherwise. Defaults to “code” when redirectUrl is provided, and to “token” otherwise.
responseType
is set to code
, Lock will never show the Last time you logged in with message, and will always prompt the user for credentials.
additionalSignUpFields
option. Each option added in this manner will then be added to that user’s user_metadata
. To learn more, read Understand How Metadata Works in User Profiles. Every input must have a name
and a placeholder
, and an icon
URL can also be provided. Also, the initial value can be provided with the prefill
option, which can be a string with the value or a function that obtains it. Other options depend on the type of the field, which is defined via the type option and defaults to “text”.
additionalSignUpFields
are intended for use with database signups only. If you have social sign ups too, you can ask for the additional information after the users sign up (see this page about custom signup for more details). You can use the databaseAlternativeSignupInstructions
i18n key to display these instructions.validator
function can also be provided.
validator
the text field will be required. If you want to make the text field optional, use a validator that always returns true
like this:
storage: 'root'
. Only a subset of values can be stored this way. The list of attributes that can be added to your root profile is here. By default, every additional sign up field is stored inside the user_metadata object.
type: "select"
will allow you to use select elements for the user to choose a value from.
options
array items for select
fields must adhere to the following format:
{label: “non empty string”, value: “non empty string”}
, and at least one option must be defined.
The options
and prefill
values can be provided through a function:
type: "checkbox"
. The prefill
value can determine the default state of the checkbox (true
or false
), and it is required.
type: "hidden"
will allow you to use a hidden input with a fixed value.
additionalSignUpFields
data for email templates, such as an option for language preferences, the value of which could then be used to set the language of templated email communications.
false
the widget won’t display the login screen. This is useful if you want to use the widget just for signups (the login and signup tabs in the signup screen will be hidden) or to reset passwords (the back button in the forgot password screen will be hidden). In such cases you may also need to specify the initialScreen
, allowForgotPassword
and allowSignUp
options. It defaults to true
.
allowLogin: false
allowForgotPassword
hides the “Don’t remember your password?” link in the Login screen, making the Forgot Password screen unreachable. Defaults to true. If you are using a database connection with a custom database which doesn’t have a change password script the Forgot Password screen won’t be available.
allowForgotPassword: false
false
, hides the login and sign up tabs in the login screen, making the sign up screen unreachable. Defaults to true
. Keep in mind that if the database connection has sign ups disabled or you are using a custom database which doesn’t have a create script, then the sign up screen won’t be available.
Also bear in mind that this option only controls client-side appearance, and does not completely stop new sign ups from determined anonymous visitors. If you are looking to fully prevent new users from signing up, you must use the Disable Sign Ups option in the dashboard, in the connection settings.
allowSignUp: false
defaultDatabaseConnection: 'test-database'
login
, signUp
, and forgotPassword
. If this option is left unspecified, the widget will default to the first screen that is available from that list.
initialScreen: 'forgotPassword'
true
.
loginAfterSignUp: false
forgotPasswordLink: 'https://yoursite.com/reset-password'
true
displays the languageDictionary.signUpTerms
string. Defaults to true
.
showTerms: false
true
displays a checkbox input alongside the terms and conditions that must be checked before signing up. The terms and conditions can be specified via the languageDictionary
option. This option will only take effect for users signing up with database connections. Defaults to false
.
mustAcceptTerms: true
allowSignUp
to true
.
signUpLink: 'https://yoursite.com/signup'
requires_username
flag set (if it is not set, usernameStyle
option will be ignored). Possible values are "username"
and "email"
. By default both username
and email
are allowed; setting this option will limit logins to use one or the other.
usernameStyle: 'username'
defaultDatabaseConnection
is provided the database connection will be used and this option will be ignored.
defaultEnterpriseConnection: 'test-database'
true
.
defaultADUsernameFromEmailPrefix: false
Auth0LockPasswordless
with an email connection, you can use this option to pick between sending a code or a magic link to authenticate the user. Available values for email connections are code
and link
. Defaults to code
. SMS connections will always use code
.
passwordlessMethod: code
configurationBaseUrl: "https://www.example.com"
https://cdn.auth0.com
since this is where all of the provided translations are stored. By providing another value, you can use another source for the language translations if needed.
languageBaseUrl: "https://www.example.com"
hashCleanup
option is enabled, it will remove the hash part of the callback URL after the user authentication. It defaults to true.
hashCleanup: false
username
, context
, and callback
as parameters. The callback expects an object like: {type: 'database', name: 'connection name'}
. This only works for database connections. Keep in mind that this resolver will run in the form’s onSubmit
event, so keep it simple and fast.
This is a beta feature. If you find a bug, please open a GitHub issue.
leeway
option can be set to an integer - a value in seconds - which can be used to account for clock skew in expirations. Typically the value is no more than a minute or two at maximum.
leeway: 30