Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/_data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ pages:
- label: generateCustomerToken mutation
url: /graphql/mutations/generate-customer-token.html

- label: generateCustomerTokenAsAdmin mutation
url: /graphql/mutations/generate-customer-token-as-admin.html

- label: handlePayflowProResponse mutation
url: /graphql/mutations/handle-payflow-pro-response.html

Expand Down
1 change: 1 addition & 0 deletions src/_includes/graphql/customer-output-24.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Attribute | Data Type | Description
--- | --- | ---
`addresses` | {{ customeraddress_text }} | An array containing the customer's shipping and billing addresses
`allow_remote_shopping_assistance` | Boolean! | Indicates whether the customer has enabled remote shopping assistance
`created_at` | String | Timestamp indicating when the account was created
`date_of_birth` | String | The customer's date of birth
`default_billing` | String | The ID assigned to the billing address
Expand Down
27 changes: 27 additions & 0 deletions src/guides/v2.4/graphql/authorization-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,33 @@ You can now use this token in the Authorization request header field for any que

If necessary, you also can [revoke the customer's token]({{ page.baseurl }}/graphql/mutations/revoke-customer-token.html

The [`generateCustomerTokenAsAdmin`]({{page.baseurl}}/graphql/mutations/generate-customer-token-as-admin.html) mutation generates a new customer token as an admin so that an administrator can perform remote shopping assistance.
The customer must have enabled the `allow_remote_shopping_assistance` feature while creating the customer profile. The mutation requires the customer email address in the payload, as shown in the following example.

**Request:**

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

**Response:**

```json
{
"data": {
"generateCustomerTokenAsAdmin": {
"customer_token": "cr0717abzoagxty1xjn4lj13kim36r6x"
}
}
}
```

## Admin tokens

In Magento GraphQL, you specify an admin token only if you need to query products, categories, price rules, or other entities that are scheduled to be in a campaign (staged content). Staging is supported in {{site.data.var.ee}} only. See [Staging queries]({{page.baseurl}}/graphql/queries/index.html#staging) for more information.
Expand Down
1 change: 1 addition & 0 deletions src/guides/v2.4/graphql/mutations/create-customer-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ The following table lists the attributes you can use as input for the `createCus

Attribute | Data Type | Description
--- | --- | ---
`allow_remote_shopping_assistance` | Boolean | Indicates whether the customer has enabled remote shopping assistance
`date_of_birth` | String | The customer’s date of birth
`dob` | String | Deprecated. Use `date_of_birth` instead. The customer’s date of birth
`email` | String! | The customer’s email address
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
group: graphql
title: generateCustomerTokenAsAdmin mutation
b2b_only: true
contributor_name: EY
---

Use the `generateCustomerTokenAsAdmin` mutation to generate a new customer token as an admin so that an administrator can perform remote shopping assistance.
The customer must have enabled the `allow_remote_shopping_assistance` feature while creating the customer profile.

## Syntax

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

## Example usage

The following call creates a new customer token.

**Request:**

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

**Response:**

```json
{
"data": {
"generateCustomerTokenAsAdmin": {
"customer_token": "cr0717abzoagxty1xjn4lj13kim36r6x"
}
}
}
```

## Input attributes

The `generateCustomerTokenAsAdmin` mutation requires the following input attribute:

Attribute | Data Type | Description
--- | --- | ---
`customer_email` | String | The customer's email address

## Output attributes

The `generateCustomerTokenAsAdmin` mutation returns a valid customer token as the output.

Attribute | Data Type | Description
--- | --- | ---
`customer_token` | String | The customer token

## Related topics

* [customer query]({{page.baseurl}}/graphql/queries/customer.html)
* [revokeCustomerToken mutation]({{page.baseurl}}/graphql/mutations/revoke-customer-token.html)
1 change: 1 addition & 0 deletions src/guides/v2.4/graphql/mutations/update-customer-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The following table lists the attributes you can use as input for the `updateCus

Attribute | Data Type | Description
--- | --- | ---
`allow_remote_shopping_assistance` | Boolean | Indicates whether the customer has enabled remote shopping assistance
`date_of_birth` | String | The customer’s date of birth
`dob` | String | Deprecated. Use `date_of_birth` instead. The customer’s date of birth
`firstname` | String | The customer’s first name
Expand Down