Android: Getting started

Gravatar for luciano.balmaceda@auth0.com
By Luciano Balmaceda
Auth0

This quickstart guide walks you through managing authentication with Auth0 in your Android apps.

Sample Projects

Each tutorial in the series includes a link to a sample project. You can find all the samples here.

Dependencies

Each tutorial uses the Auth0.Android library. It is a toolkit that lets you communicate with many of the basic Auth0 API functions in a neat way.

Create an Application

Create a new client application in your Auth0 dashboard. For Type, select Native.

App Dashboard

Configure Callback URLs

A callback URL is a URL in your application where Auth0 redirects the user after they have authenticated.

You need to whitelist the callback URL for your app in the Allowed Callback URLs field in your Application Settings. If you do not set any callback URL, your users will see a mismatch error when they log in.

This tutorial series uses a callback URL that looks like this:

demo://YOUR_AUTH0_DOMAIN/android/YOUR_APP_PACKAGE_NAME/callback

Replace YOUR_APP_PACKAGE_NAME with your application's package name, available as the applicationId attribute in the app/build.gradle file.

Set Credentials

You will need some details about this application to communicate with Auth0. You can get these details from the Application Settings section in the Auth0 dashboard.

You need the following information:

  • Client ID
  • Domain

We suggest you do not hardcode these values as you may need to change them in the future. Instead, use String Resources, such as @string/com_auth0_domain, to define the values.

Edit your res/values/strings.xml file as follows:

<resources>
    <string name="com_auth0_client_id">YOUR_CLIENT_ID</string>
    <string name="com_auth0_domain">YOUR_AUTH0_DOMAIN</string>
</resources>

If you download the sample from the top of this page, these details are filled out for you. If you have more than one application in your account, the sample comes with the values for your Default App.

Use Auth0 for FREECreate free Account