Storefront API - customer access token

Shopify Partner
4 0 0

Hi all!

When the customer logged in his account on the storefront, I am going to make him to see his order data using Graphsql storefront API.

But in order to use this, I need to know the customer access token.

And to generate this token, I need to know the customer's email and password.

- To retrieve the customer Data
/api/2019-07/graphql.json
{
    customer (customerAccessToken: "da3951b043bda30c6344d634b0dcd94d")
    {
         ... ... ...
    }
}

- To create the customerAccessToken

https://shopify.dev/docs/storefront-api/reference/mutation/customeraccesstokencreate#interactive-exa...

Though the customer already logged in, I can't get his email and password in frontend code like jquery...

How can I proceed this?

Thank you

0 Likes
Highlighted
Shopify Partner
4 0 0

Did anyone have a chance to look into my question?

Thanks

0 Likes
Highlighted
Shopify Staff
Shopify Staff
648 87 93

Hey @ttdpartners,

 

Do you have to use the Storefront API? Since they're already logged in, how about using liquid to pull out the order details? Something like:

 

{% for order in customer.orders %}
  {{ order.id }}
{% endfor %}
0 Likes