Android Introduction

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 either Lock or the Auth0.Android library.

  • Lock is an Activity that is easy to present in your app. It contains default templates (that can be customized) for login with email/password, sign up, social providers integration, and also password recovery.
  • Auth0.Android is a toolkit that lets you communicate with many of the basic Auth0 API functions in a neat way.

The Lock dependency is already integrated in each sample project through Gradle. Lock packs most of the Auth0.Android functionality inside.

Create a Client

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

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

If you wish to only use DB connections, skip this point.

The callback URLs are meant to be used to receive the OAuth response when logging in with social connections or enterprise connections. To set a callback URL, navigate to the settings for your client application and include the URL in the "Callback URLs" text box.

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 data path for Lock (located in AndroidManifest.xml) also needs to be set.

<data
  android:host="@string/auth0_domain"
  android:pathPrefix="/android/YOUR_APP_PACKAGE/callback"
  android:scheme="https" />

Next Tutorial
2. Login
Use Auth0 for FREECreate free Account