> For the complete documentation index, see [llms.txt](https://docs.suggestic.com/graphql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.suggestic.com/graphql/query/mutations/user-profile/login-user.md).

# Login User

Use this mutation to login a 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 %}
