> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Auth0.Android Login, Logout, and User Profiles

> Learn how to add login, log out and read the user profile using the Android SDK.

## Add login to your Android application

You can log the user in using the `WebAuthProvider.login` method:

```kotlin lines theme={null}
WebAuthProvider.login(account)
  .withScheme(getString(R.string.com_auth0_scheme))
  .withScope("openid profile email")
  .start(this, object : Callback<Credentials, AuthenticationException> {
    override fun onFailure(exception: AuthenticationException) {
       // Authentication failed
     }

      override fun onSuccess(credentials: Credentials) {
         // Authentication succeeded
       }
  })
```

The authentication result will be delivered to the `onSuccess` callback.

See the [Auth0.Android configuration](/docs/docs/libraries/auth0-android/auth0-android-configuration) for more options for the `WebAuthProvider` class.

## Add logout to your Android application

To log the user out, call the `WebAuthProvider.logout` method. The result of logout will be supplied in the `onSuccess` callback.

This method removes the cookie that the browser set at authentication time, so it forces users to re-enter their credentials the next time they try to authenticate.

If the logout is cancelled, you might want to take the user back to where they were before attempting to log out.

```kotlin lines theme={null}
WebAuthProvider.logout(account)
  .withScheme("demo")
  .start(this, object: Callback<Void?, AuthenticationException> {
    override fun onSuccess(payload: Void?) {
      // The user has been logged out!
    }

    override fun onFailure(error: AuthenticationException) {
      // Something went wrong!
    }
  })
```

## Show the user's profile

Use the `AuthenticationAPIClient` class to retrieve the user's profile from Auth0. This requires:

* The access token (Access Token: Authorization credential, in the form of an opaque string or JWT, used to access an API.) as received during the login phase
* The `profile` scope to include when `WebAuthProvider.login` is called
* The `email` scope (if you want to retrieve the user's email address)

This sample demonstrates a function that retrieves the user's profile and displays it on screen:

```kotlin lines theme={null}
var client = AuthenticationAPIClient(account)

// Use the received access token to call `userInfo` and get the profile from Auth0.
client.userInfo(accessToken)
  .start(object : Callback<UserProfile, AuthenticationException> {
      override fun onFailure(exception: AuthenticationException) {
          // Something went wrong!
      }

      override fun onSuccess(profile: UserProfile) {
        // We have the user's profile!
        val email = profile.email
        val name = profile.name
      }
})
```
