Android Getting started

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 a Client

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 Client 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

Your application needs some details about your client to communicate with Auth0. You can get these details from the Settings section for your client 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 client in your account, the sample comes with the values for your Default App.

Next Tutorial
2. Login
Use Auth0 for FREECreate free Account