# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mburger.cloud/api-docs-1/integrations-extensions/users/login.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
