Lock for Android v2 Configuration


These are options that can be used to configure Lock for Android to your project's needs. Note that if you are a user of Lock v1 who is now migrating to Lock v2, you'll want to take note first of those options that have been renamed or whose behavior have changed, and then look over the new list below, which contains quite a few options new to v2.

Configurations options are added to the Lock Builder using the following format:

 lock = Lock.newBuilder(auth0, callback)
    // Configuration options
    // End configuration options

UI 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.

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 is openid. If you want to specify a different one, use withAuthenticationParameters and add a different value for the scope key.
  • withScope(String): Changes the scope 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 and EMAIL. By default it will respect the Dashboard configuration of the parameter requires_username.
  • loginAfterSignUp(boolean): Whether after a SignUp event the user should be logged in automatically. Defaults to true.
  • initialScreen(int): Allows to customize which form will first appear when launching Lock. The accepted values are LOG_IN, SIGN_UP, and FORGOT_PASSWORD. By default LOG_IN is the initial screen.
  • allowSignUp(boolean): Shows the Sign Up form if a Database connection is configured and it's allowed from the Dashboard. Defaults to true.
  • allowLogIn(boolean): Shows the Log In form if a Database connection is configured. Defaults to true.
  • allowForgotPassword(boolean): 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.
  • 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
  • setTermsURL(String): Allows to customize the Terms of Service URL. Defaults to
  • 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 to true. If the hideMainScreenTitle option is set to true this setting is ignored and a label will be used anyways.
  • hideMainScreenTitle(boolean): If set to true, the header on the main screen won't display the title.

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.
  • withAuthHandlers(AuthHandler...): Customize the authentication process by passing an array of AuthHandlers. See this document on custom authentication parameters for more information.
  • withConnectionScope(String, String...): Allows to specify additional scopes for a given Connection name, which will be request 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 in 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 is https. When changing this setting, the intent-filter on the AndroidManifest.xml file and the Allowed Callbacks URLs on the 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.