Lock.Android: Configuration
You can use the options below to configure functions and design for Lock for Android.
Configurations options are added to the Lock Builder using the following format:
val lock = Lock.newBuilder(account, callback)
// Configuration options
.closable(true)
.allowSignUp(false)
.setPrivacyURL('http://example.com/privacy')
.setTermsURL('http://example.com/terms')
// End configuration options
.build(this)
Was this helpful?
General options
closable(boolean): Defines if the LockActivity can be closed. By default, it's not closable.
allowedConnections(List): Filters the allowed connections from the list configured in the Dashboard. By default if this value is empty, all the connections defined in the dashboard will be available.
hideMainScreenTitle(boolean): If set to
true
, the header on the main screen won't display the title.
Authentication options
withAuthenticationParameters(Map<String, Object>): Defines extra authentication parameters to be sent on each log-in and sign-up call. The default
scope
used on authentication calls isopenid
. If you want to specify a different one, usewithAuthenticationParameters
and add a different value for thescope
key.withScope(String): Changes the scope requested when performing an authentication request.
withAudience(String): Changes the audience requested when performing an authentication request.
Database options
withUsernameStyle(int): Defines if it should ask for email only, username only, or both of them. The accepted values are
USERNAME
andEMAIL
. By default, it will respect the Dashboard configuration of the parameterrequires_username
.loginAfterSignUp(boolean): Whether after a
SignUp
event the user should be logged in automatically. Defaults totrue
.initialScreen(int): Allows to customize which form will first appear when launching Lock. The accepted values are
LOG_IN
,SIGN_UP
, andFORGOT_PASSWORD
. By defaultLOG_IN
is the initial screen.allowSignUp(boolean): Shows the signup form if a Database connection is configured and it's allowed from the Dashboard. Defaults to
true
.allowLogIn(boolean): Shows the login form if a Database connection is configured. Defaults to
true
.allowForgotPassword(boolean): This shows the Forgot Password form if a Database connection is configured and it's allowed from the Dashboard. Defaults to
true
.allowShowPassword(boolean): Shows a button to toggle the input visibility of a Password field. Defaults to
true
.setDefaultDatabaseConnection(String): Defines which will be the default Database connection. This is useful if your application has many Database connections configured.
enableEnterpriseWebAuthenticationFor(List): Filters the enterprise connections that will launch a web authentication flow via the browser when clicked. Only 'ad', 'adfs', or 'waad' strategies are allowed.
withSignUpFields(List): Shows a second screen with extra fields for the user to complete after the username/email and password were completed in the sign-up screen. Values submitted this way can be stored in the user profile using either a root attribute or the
user_metadata
attribute. For more info, see Lock Android: Custom Fields at Signup.setPrivacyURL(String): Allows to customize the Privacy Policy URL. Defaults to
https://auth0.com/privacy
.setTermsURL(String): Allows to customize the Terms of Service URL. Defaults to
https://auth0.com/terms
.setSupportURL(String): Allows to set a Support URL that will be displayed in case that a non-recoverable error raises on Lock.
setMustAcceptTerms(boolean): Forces the user to accept the Terms&Policy before signing up. Defaults to
false
.useLabeledSubmitButton(boolean): If set to
true
, it will display a label of the current mode (sign up/ log in) in the submit button instead of an icon. Defaults totrue
. If thehideMainScreenTitle
option is set to true this setting is ignored and a label will be used anyways.
OAuth options
withAuthStyle(String, int): Customize the look and feel of a given connection (name) with a specific style. See this document on custom oauth connections for more information.
withConnectionScope(String, String...): Allows to specify additional scopes for a given Connection name, which will be requested along with the ones defined in the connection settings in the Auth0 Dashboard. The scopes are not validated in any way and need to be recognized by the given authentication provider. For a list, check the Auth0 Dashboard under the settings for the connection in question.
withScheme(String): Allows to change the scheme of the
redirect_uri
sent on the authorize call. By default, the scheme ishttps
. If this setting is changed, the manifest placeholder for theauth0Scheme
and the "Allowed Callbacks URLs" on the Auth0 application dashboard must be updated too.
Passwordless options
useCode(): Send a code instead of a link via email/SMS for Passwordless authentication.
useLink(): Send a link instead of a code via email/SMS for Passwordless authentication.
rememberLastLogin(boolean): Whether the email or phone used in the last successful authentication will be saved to auto-login the next time a Passwordless authentication is requested.