Get customer authorization token
To successfully retrieve information about a specific customer using GraphQL, you need to provide the customer’s authorization token.
The following example shows how to retrieve a customer’s authorization token:
Request:
1
2
3
4
5
mutation {
generateCustomerToken(email: "customer@example.com", password: "password") {
token
}
}
Response:
1
2
3
4
5
6
7
{
"data": {
"generateCustomerToken": {
"token": "hoyz7k697ubv5hcpq92yrtx39i7x10um"
}
}
}
You can now use this token in the Authorization request header field for any queries and mutations.
If necessary, you also can revoke the customer’s token.