generateCustomerTokenAsAdmin mutation

The generateCustomerTokenAsAdmin mutation generates a new customer token as an admin so that an administrator can perform remote shopping assistance on behalf of the customer. For example, if a customer has asked for help adding a product into their cart, you would specify the token returned by the generateCustomerTokenAsAdmin mutation in the header of your addProductsToCart mutation.

To run this mutation, the customer must have enabled the Allow remote shopping assistance feature. You can specify the allow_remote_shopping_assistance attribute in a customer query to determine whether the customer enabled this feature.

Syntax

mutation {generateCustomerTokenAsAdmin(input: GenerateCustomerTokenAsAdminInput!) {GenerateCustomerTokenAsAdminOutput}}

Reference

The generateCustomerTokenAsAdmin reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following call creates a new customer token.

Request:

mutation{
  generateCustomerTokenAsAdmin(input: {
    customer_email: "customer1@mail.com"
  }){
    customer_token
  }
}

Response:

{
  "data": {
    "generateCustomerTokenAsAdmin": {
      "customer_token": "cr0717abzoagxty1xjn4lj13kim36r6x"
    }
  }
}
data-slots=text
data-backgroundcolor=gray
Thanks to EY for contributing this topic!