> For the complete documentation index, see [llms.txt](https://docs.mburger.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mburger.cloud/android-docs/auth-feature/authenticate-a-user.md).

# Authenticate a user

After a successful registration you would probably need to authenticate your user by using the registration email and password, so you will need to call:

```kotlin
private var listener: MBAuthApiAuthenticateListener 
private var email, password: String

MBurgerAuthTasks.authenticateUser(applicationContext, 
    listener,            //Listener for authentication
    email,               //Email of the user
    password);           //Password of the user
```

This method will return the **`jwt_token`** that will automatically be used in all subsequent calls until the app is uninstalled or the user is logged out in order to authenticate all API calls.

&#x20;It will be automatically stored encrypted within your application, but if you need to save it for your purposes you can obtain it through the listener or with the “action” mode inside the returned bundle with the key `MBApiPayloadKeys.key_jwt_token`.

If you wish to **logout** a user just callJava

```kotlin
MBurgerAuthTasks.clearAuthToken(applicationContext);
```

{% hint style="warning" %}
Make sure that your app UI will respond to the “logout” in a significative way.
{% endhint %}
