Next Commerce

tokenAuth

Obtain JSON web token for given user.

Arguments

input·ObtainJSONWebTokenInput!non-nullinput

Return type

ObtainJSONWebTokenPayloadobject
payload·GenericScalar!non-nullscalar
refreshExpiresIn·Int!non-nullscalar
success·Booleanscalar
errors·ExpectedErrorTypescalar
user·UserNodeobject
clientMutationId·Stringscalar
token·String!non-nullscalar
Mutation Reference
mutation TokenAuth($input: ObtainJSONWebTokenInput!) {
  tokenAuth(input: $input) {
    payload
    refreshExpiresIn
    success
    errors
    clientMutationId
    token
  }
}
Variables
{
  "input": {
    "clientMutationId": "<your-value>",
    "email": "<your-value>",
    "password": "<your-value>"
  }
}
JSON Response
{
  "data": {
    "tokenAuth": {
      "payload": {},
      "refreshExpiresIn": 1,
      "success": true,
      "errors": null,
      "user": {
        "id": "<id>",
        "lastLogin": "2026-01-01T00:00:00Z",
        "isActive": true,
        "email": "<your-value>",
        "phoneNumber": "<your-value>",
        "firstName": "<your-value>",
        "lastName": "<your-value>",
        "ip": "<your-value>",
        "language": "<your-value>",
        "isBlocked": true,
        "userType": "LEAD",
        "acceptsMarketing": true,
        "metadata": {},
        "userAgent": "<your-value>",
        "firstPurchaseDate": "2026-01-01T00:00:00Z",
        "lastPurchaseDate": "2026-01-01T00:00:00Z",
        "dateJoined": "2026-01-01T00:00:00Z",
        "agentMarketingAttributions": [
          {
            "id": "<id>",
            "utmSource": "<your-value>",
            "utmMedium": "<your-value>",
            "utmCampaign": "<your-value>",
            "utmTerm": "<your-value>",
            "utmContent": "<your-value>",
            "gclid": "<your-value>",
            "campaign": "<your-value>",
            "metadata": {},
            "affiliate": "<your-value>",
            "subaffiliate1": "<your-value>",
            "subaffiliate2": "<your-value>",
            "subaffiliate3": "<your-value>",
            "subaffiliate4": "<your-value>",
            "subaffiliate5": "<your-value>"
          }
        ],
        "pk": 1
      },
      "clientMutationId": "<your-value>",
      "token": "<your-value>"
    }
  }
}