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 .closable(true) .allowSignUp(false) .setPrivacyURL('http://example.com/privacy') .setTermsURL('http://example.com/terms') // End configuration options .build(this);
- closable(boolean): Defines if the LockActivity can be closed. By default it's not closable.
): 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.
- withAuthenticationParameters(Map<String, Object>): Defines extra authentication parameters to be sent on each log in and sign up call. The default
scopeused on authentication calls is
openid. If you want to specify a different one, use
withAuthenticationParametersand add a different value for the
- withScope(String): Changes the scope requested when performing an authentication request.
- withUsernameStyle(int): Defines if it should ask for email only, username only, or both of them. The accepted values are
- loginAfterSignUp(boolean): Whether after a
SignUpevent the user should be logged in automatically. Defaults to
- initialScreen(int): Allows to customize which form will first appear when launching Lock. The accepted values are
FORGOT_PASSWORD. By default
LOG_INis 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
- allowLogIn(boolean): Shows the Log In form if a Database connection is configured. Defaults to
- allowForgotPassword(boolean): Shows the Forgot Password form if a Database connection is configured and it's allowed from the Dashboard. Defaults to
- allowShowPassword(boolean): Shows a button to toggle the input visibility of a Password field. Defaults to
- setDefaultDatabaseConnection(String): Defines which will be the default Database connection. This is useful if your application has many Database connections configured.
): 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 will be attached to the user profile in
user_metadata. See this file for more information.
- 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
- 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
hideMainScreenTitleoption 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.
- 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.
- withAuthButtonSize(int): Allows to customize the Style of the Auth buttons. Possible values are
BIG. If this is not specified, it will default to
SMALLwhen using ClassicLock with at least 2 Enterprise or Database connections, or when using PasswordlessLock with a Passwordless connection and less than 3 Social connections. On the rest of the cases, it will use
- 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_urisent on the authorize call. By default, the scheme is
https. When changing this setting, the intent-filter on the
AndroidManifest.xmlfile and the Allowed Callbacks URLs on the client dashboard must be updated too.
- 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.