Android Getting started

This multistep quickstart guide will walk you through managing authentication in your android apps with Auth0.

Sample Projects

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

Dependencies

Each tutorial will require you to use the Auth0.Android library. This is a toolkit that lets you communicate with many of the basic Auth0 API functions in a neat way.

Create a Client

If you haven't already done so, create a new client application in your Auth0 dashboard and choose Native for the Type.

App Dashboard

Configure Callback URLs

Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 routes your application back to this URL and appends additional parameters to it, including a token. Since callback URLs can be manipulated, you will need to add your application's URL to your client's Allowed Callback URLs for security. This will enable Auth0 to recognize these URLs as valid. If omitted, authentication will not be successful.

Callback error

To set a callback URL, navigate to the settings for your client application and include the URL in the "Allowed Callback URLs" text box.

This tutorial series make use of a Callback URL that looks like this:

demo://YOUR_AUTH0_DOMAIN/android/YOUR_APP_PACKAGE_NAME/callback

Remember to replace YOUR_APP_PACKAGE_NAME with your actual application's package name. Take note of this URL as it's also defined in the AndroidManifest.xml file.

Set Credentials

You will require the Client ID and Domain for your client application. These values can be found in your Auth0 dashboard. The suggested approach is to add these credentials to your strings.xml file so they are accessible to your application.

<string name="auth0_client_id">YOUR_CLIENT_ID</string>
<string name="auth0_domain">YOUR_AUTH0_DOMAIN</string>

The values are also used in the Intent-Filter declared in the AndroidManifest.xml:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data
      android:host="@string/auth0_domain"
      android:pathPrefix="/android/YOUR_APP_PACKAGE_NAME/callback"
      android:scheme="demo" />
</intent-filter>

Replace YOUR_APP_PACKAGE_NAME with your actual application's package name.

Next Tutorial
2. Login
Use Auth0 for FREECreate free Account