Auth0.Android Database Authentication

Username/Email & Password authentication from native applications is disabled by default for new tenants as of 8 June 2017. Users are encouraged to use Universal Login and perform Web Authentication instead. If you still want to proceed you'll need to enable the Password Grant Type on your dashboard first. See Application Grant Types for more information.

Log in with a database connection

To log in with a database connection, call login with the user's email, password, and the connection you want to authenticate with. The response is a Credentials object.

authentication
    .login("username@domain.com", "a secret password", "my-database-connection")
    .start(object: Callback<Credentials, AuthenticationException> {
        override fun onSuccess(payload: Credentials) {
            // Logged in!
        }

        override fun onFailure(error: AuthenticationException) {
            // Error!
        }
    })

The default scope is openid profile email.

Sign up with a database connection

To sign up with a database connection, call the signUp method, passing the user's email, password, and connection name.

authentication
    .signUp("username@domain.com", "a secret password", "my-database-connection")
    .start(object: Callback<Credentials, AuthenticationException> {
        override fun onSuccess(result: Credentials) {
            // Signed Up & Logged in!
        }

        override fun onFailure(error: AuthenticationException) {
            // Error!
        }
    });