# Login

{% hint style="info" %}
This will show you how to log in a user using the **mobile** provider. It will give you a JWT token which will be needed for the following APIs.
{% endhint %}

{% hint style="warning" %}
If you try to authenticate a user by email, but the email was previously registered through Facebook, Google or Apple, MBurger will throw out an error as the user is already registered with "email" mode.
{% endhint %}

{% hint style="warning" %}
To know more about the social token please refer to [Facebook](https://developers.facebook.com/docs/facebook-login), [Google](https://developers.google.com/identity) or [Apple](https://developer.apple.com/sign-in-with-apple/)
{% endhint %}

{% tabs %}
{% tab title="Request" %}
`POST https://mburger.cloud/api/login`

```bash
curl https://mburger.cloud/api/login
 -X POST 
 -H "Accept: application/json" 
 -H "Content-Type: application/x-www-form-urlencoded" 
 -H "X-MBurger-Token: " 
 -H "X-MBurger-Version: 3"
 -d '<data>' 
```

#### Parameters

| Name            | Type   | Required | Description                                                                 |
| --------------- | ------ | -------- | --------------------------------------------------------------------------- |
| email           | string | No       | Email                                                                       |
| password        | string | No       | Password                                                                    |
| mode            | string | Yes      | Auth mode : *email, facebook, google, apple*                                |
| facebook\_token | string | No       | Facebook token obtained from Facebook SDK, **required if mode = facebook**. |
| google\_token   | string | No       | Google token, obtained from Google SDK, **required if mode = google**.      |
| apple\_token    | string | No       | Apple token, obtained from Apple SDK, **required if mode = apple**.         |
| {% endtab %}    |        |          |                                                                             |

{% tab title="Response" %}
When succesful, a HTTP 200 and JSON like this is returned:

```bash
{
  "status_code": 0,
  "body": {
    "access_token": "JWT",
    "token_type": "Bearer"
  }
}
```

{% endtab %}
{% endtabs %}
