Android Custom Login

This quickstart will show you how to add Auth0 login capabilities while using a customized login screen.

Sample Project

Download this sample project configured with your Auth0 API Keys.

System Requirements
  • Android Studio 2.2
  • Android SDK 24
  • Emulator - Nexus 5X - Android 6.0
Show requirements

Before Starting

Go to the Client Settings section in the Auth0 dashboard and make sure that Allowed Callback URLs contains the value:


Add The Auth0 Android Dependency

Your first step is to add Auth0 Android into your project, which is basically the library that will manage the login process, via Auth0 Authentication Client.

i. Gradle

Add to your app's module Gradle file:

compile ''

Then, run "Sync project with Gradle files" inside Android Studio or ./gradlew clean assembleDebug from the command line.

For more information about Gradle usage, check their official documentation.

2. Configure Your Manifest File

You need to add the following permissions inside the AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

Implement The Login

At this point, you're all set to implement the login in any activity you want.

First, in your customized login method, instantiate the Authentication API:

private void login(String email, String password) {
    Auth0 auth0 = new Auth0("YOUR_CLIENT_ID", "YOUR_AUTH0_DOMAIN");
    AuthenticationAPIClient client = new AuthenticationAPIClient(auth0);

    // proper login

Then, login using the newly created client:

String connectionName = "Username-Password-Authentication";
client.login(email, password, connectionName)
    .start(new BaseCallback<Credentials, AuthenticationException>() {
        public void onSuccess(Credentials payload) {
            // Store credentials
            // Navigate to your main activity

        public void onFailure(AuthenticationException error) {
            // Show error to user

In this example we're logging in using an Auth0 Database Connection called "Username-Password-Authentication". You can also create your own.

There are multiple ways of designing a customized login screen which are not covered in this tutorial. You can take the Android Studio's login template as an example.

Previous Tutorial
2. Login
Use Auth0 for FREECreate free Account