This multistep quickstart guide will walk you through managing authentication in your android apps with Auth0.
These tutorials and seed projects have been tested with the following:
- Android Studio 2.2
- Emulator - Nexus 5X - Android 6.0
Each tutorial in the series includes a link to its corresponding sample project. You can find all the samples here.
- Lock is an
Activitythat 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.
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.
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.
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.
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_NAMESPACE</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" />