Auth0.Android Database Authentication
Database authentication on Native Platforms
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 wish to authenticate with. The response will be a Credentials object.
Additionally, specifying the audience will yield an OIDC-conformant response during authentication.
authentication
.login("info@auth0.com", "a secret password", "my-database-connection")
.setAudience("https://YOUR_DOMAIN/userinfo")
.start(new BaseCallback<Credentials, AuthenticationException>() {
@Override
public void onSuccess(Credentials payload) {
//Logged in!
}
@Override
public void onFailure(AuthenticationException error) {
//Error!
}
});
The default scope used is openid
.
Sign up with database connection
To sign up with a database connection you have to call the signUp
method, passing the user's email, password, and connection name.
authentication
.signUp("info@auth0.com", "a secret password", "my-database-connection")
.setAudience("https://YOUR_DOMAIN/userinfo")
.start(new BaseCallback<Credentials, AuthenticationException>() {
@Override
public void onSuccess(Credentials payload) {
//Signed Up & Logged in!
}
@Override
public void onFailure(AuthenticationException error) {
//Error!
}
});