> ## Documentation Index
> Fetch the complete documentation index at: https://auth0-docs-event-stream-action-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Learn how to install, initialize, and use Auth0.Android

# Auth0.Android

Auth0.Android is a client-side library you can use with your Android app to authenticate users and access [Auth0 APIs](/docs/api).

Check out the [Auth0.Android repository](https://github.com/auth0/Auth0.Android) on GitHub.

## Requirements

Android API version 21 or newer is required.

## Installation

Add the SDK into your project. The library will make requests to Auth0's Authentication and Management APIs.

### Add Auth0 to Gradle

In your app's `build.gradle` dependencies section, add the following:

```kotlin lines theme={null}
dependencies {
  // Add the Auth0 Android SDK
  implementation 'com.auth0.android:auth0:2.+'
}
```

If Android Studio lints the `+` sign, or if you want to use a fixed version, check for the latest in [Maven](https://central.sonatype.com/artifact/com.auth0.android/auth0).

<Card title="Sync project with Gradle">
  Remember to synchronize using the Android Studio prompt or run `./gradlew clean build` from the command line.
</Card>

In the `android` section, target Java 8 byte code for Android and Kotlin plugins respectively.

```kotlin lines theme={null}
android {
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  kotlinOptions {
    jvmTarget = '1.8'
  }
}
```

### Permissions

Open your application's `AndroidManifest.xml` file and add the following permission.

```text lines theme={null}
<uses-permission android:name="android.permission.INTERNET" />
```

## Configure for Universal Login

First, go to [Dashboard > Applications](https://manage.auth0.com/#/applications) and click the name of the application you want to edit. In **Allowed Callback URLs**, make sure your URL follows this format:
`https://YOUR_DOMAIN/android/{YOUR_APP_PACKAGE_NAME}/callback`

Next, replace `{YOUR_APP_PACKAGE_NAME}` with your actual application's package name. You can find this in your `app/build.gradle` file as the `applicationId` value.

Then, in your `app/build.gradle` file, add the [Manifest Placeholders](https://developer.android.com/build/manage-manifests) for the Auth0 Domain and the Auth0 Scheme properties, which the library will use to register an intent-filter that captures the callback URI.

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  If you don't plan to use the Web Authentication feature and not declare the manifest placeholders, you can manually redeclare the activity in your Android app's manifest file to remove it from the merged manifest file. This will prevent Gradle from complaining that the manifest placeholders are missing.

  Please [read the FAQ](https://github.com/auth0/auth0.android/blob/main/FAQ.md) for more information.
</Callout>

```kotlin lines theme={null}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.auth0.samples"
        minSdkVersion 21
        targetSdkVersion 30
        //...

        //---> Add the next line
        manifestPlaceholders = [auth0Domain: "@string/com_auth0_domain", auth0Scheme: "https"]
        //<---
    }
    //...
}
```

<Callout icon="file-lines" color="#0EA5E9" iconType="regular">
  It's a good practice to define reusable resources like `@string/com_auth0_domain` rather than just hard-coding them.
</Callout>

## Initialize Auth0

Create a new `Auth0` object using your Auth0 <Tooltip tip="Client ID: Identification value given to your registered resource from Auth0." cta="View Glossary" href="/docs/glossary?term=client+ID">client ID</Tooltip> and domain value. Objects will later use this when interacting with Auth0's endpoints.

```kotlin lines theme={null}
val auth0 = Auth0("{yourClientId}", "YOUR_DOMAIN")
```

You can also initialize this object using an Android Context, as shown in [this usage example](https://github.com/auth0/Auth0.Android/tree/master#usage).

## Next steps

[Log users in and out of your application](/docs/libraries/auth0-android/auth0-android-login-logout-and-user-profiles) using the `WebAuthProvider` class.

### Reset user password

To initiate a password reset for a user, call `resetPassword` with the user's email address and the database connection name as parameters.

Password reset requests will fail on network-related errors, but will not fail if the designated email does not exist in the database (for security reasons).

## Learn more

* [Auth0.Android Login, Logout, and User Profiles](/docs/libraries/auth0-android/auth0-android-login-logout-and-user-profiles)
* [Auth0.Android Configuration Options](/docs/libraries/auth0-android/auth0-android-configuration)
* [Auth0.Android Database Authentication](/docs/libraries/auth0-android/auth0-android-database-authentication)
* [Auth0.Android Passwordless Authentication](/docs/libraries/auth0-android/auth0-android-passwordless)
* [Auth0.Android: User Management](/docs/libraries/auth0-android/auth0-android-user-management)
