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, available in the app/build.gradle file as the applicationId attribute.

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 use String Resources like @string/com_auth0_domain to define them instead of hard coding the value, as you might need to change them in the future and forget to update them in all the places. Edit your res/values/strings.xml file like this:

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

If you're logged in with your Auth0 account and download the samples from the "Download Sample" button, the values will be completed for you.

Next Tutorial
2. Login
Use Auth0 for FREECreate free Account