Configuring Lock’s behavior
Configuration options can be added to your Lock initialization usingwithOptions
.
Behavior Options
closable
Allows Lock to be dismissed by the user. By default this isfalse
.
scope
Scope used for authentication. By default isopenid
. It will return not only the , but also an which is a (JWT) containing user information. See the documentation on Scopes for more information about authentication scopes.
Refresh Tokens
Specifying theoffline_access
scope in your Lock options will allow a Refresh Token to be returned along with the access_token and the id_token. can be saved and used to acquire a new Access Token when the old one expires. For more information about using Refresh Tokens for Auth0 authentication, take a look at the reference documentation for the Auth0.Swift SDK, which you would use to implement Refresh Tokens, or at the Swift Quickstart Guide, which provides a comprehensive example of use of Auth0 in Swift development, including the management of Refresh Tokens.
termsOfService
By default Lock will use Auth0’s Terms of Service and Privacy Policy, but other URLs can be filled in to link to other terms and policies.Show Terms of Service
Database connections display the Terms of Service dialog. Default istrue
. Note that the Terms of Service will always be shown if the mustAcceptTerms
flag is enabled.
Require users to accept the Terms of Service
Database connection require explicit acceptance of the Terms of Service.Web Authentication Options
leeway
Clock skew used for ID token validation. It expands the time window in which the ID token will still be considered valid, to account for the difference between server time and client time. By default is 60000 milliseconds (60 seconds).maxAge
Allowable elapsed time (in milliseconds) since the user last authenticated. Used for ID token validation. If set, the ID token will contain anauth_time
claim with the authentication timestamp. Defaults to nil
.
Database options
allow
Which database screens will be accessible, the default is enable all screens such as.Login, .Signup, .ResetPassword
.
initialScreen
The first screen to present to the user. The default is.Login
, other options include .Signup
and ResetPassword
.
usernameStyle
Specify the type of identifier the login will require. The default is either:[.Username, .Email]
, but it can also accept [.Username]
or [.Email]
. However it’s important to note that this option is only active if you have set the requires_username
flag to true
in your Auth0 Dashboard.
Custom Signup Fields
When signing up the default information requirements are the user’s email and password. You can expand your data capture requirements as needed. Capturing additional signup fields here will store them in theuser_metadata
, which you can read more about in Metadata. Note that you must specify the icon to use with your custom text field.
Enterprise Options
There are also configuration options specific to Enterprise connections:enterpriseConnectionUsingActiveAuth
By default Enterprise connections will use Web Authentication. However, you can specify which connections will alternatively use credential authentication and prompt for a username and password.activeDirectoryEmailAsUsername
When in credential authentication mode, should the user require their email as an identifier? The default isfalse
, and instead requires a username.
Logging Options
Lock provides options to easily turn on and off logging capabilities, as well as adjust other logging related settings.logLevel
By default this is.off
, Syslog logging levels are supported.
logHttpRequest
Whether or not to log Auth0.swift API requests. By default this isfalse
.
loggerOutput
Specify logger output handler, by default this uses theprint
statement.