# Login User

Use the login mutation to obtain a JWT authentication for third parties only. This sends a `user_id` and returns an access token and a refresh token.&#x20;

## Requirements

* To have the [userId ](https://docs.suggestic.com/graphql/query/queries/my-list)which will indicate the user who will be logged in.

## Required Argument

<table data-header-hidden><thead><tr><th width="402.3333333333333">Argument</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Argument</td><td>Type</td><td>Description</td></tr><tr><td><code>userID</code></td><td>String</td><td>The user's ID</td></tr></tbody></table>

## Available Fields

| Field          | Type   | Description                                                                                 |
| -------------- | ------ | ------------------------------------------------------------------------------------------- |
| `accessToken`  | String | Access token that is passed in the header                                                   |
| `refreshToken` | String | The refresh token that is used to obtain another access\_token when the current one expires |

## Example

{% tabs %}
{% tab title="Mutation" %}

```graphql
mutation {
  login(userId: "305c5386-1e1e-4d01-019f-521b2d94e9e4") {
    accessToken
    refreshToken
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "login": {
      "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ0MDgyMDAsInVpZCI6IjMwNWM1Mzg2LWI3YjgtNGQwMS05ZjRlLTUyMWIyZDk0ZTllNCIsInBpZCI6IjQ2YmY0ZmM1LWI5N2QtNDU2Mi05NDkyLWI1OGZhNDkwYzU0YSIsImlzcyI6InNnOmFwcCIsImF1ZCI6InNnOnVzZXIiLCJpYXQiOjE2MjMxOTg2MDAsImNhdCI6IjIwMjEwNTAyMjAxNCIsImFwcCI6ImxpbGlhbmFzdWdnZXN0aWNjb20ifQ.wzx6i36BO8FOihpm012WeKcdljSVRE5GQcRd_h-0zf8",
      "refreshToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjU2MTc4MDAsInVpZCI6IjMwNWM1Mzg2LWI3YjgtNGQwMS05ZjRlLTUyMWIyZDk0ZTllNCIsInBpZCI6IjQ2YmY0ZmM1LWI5N2QtNDU2Mi05NDkyLWI1OGZhNDkwYzU0YSIsImlzcyI6InNnOmFwcCIsImF1ZCI6InNnOnVzZXIiLCJpYXQiOjE2MjMxOTg2MDAsImNhdCI6IjIwMjEwNTAyMjAxNCIsImFwcCI6ImxpbGlhbmFzdWdnZXN0aWNjb20ifQ.BJutOP6mhLyryiklBrX-fdI4HFu0Z68Lzbe_9nTWcVc"
    }
  }
}
```

{% 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.suggestic.com/graphql/query/mutations/user-profile/login-user.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.
