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.
https://shopify.dev/docs/storefront-api/reference/mutation/customeraccesstokencreate#interactive-example-2020-01
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
Did anyone have a chance to look into my question?
Thanks
SBD
April 1, 2020, 5:51am
3
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 %}
Hi, I think you can store the CustomerAccessToken which you’ve got once the User logs In into your store and use that token to retrieve the orders. But make sure the token hasn’t expired. If expired, you might need to forcefully logout the customer and ask for log-in again.
Hope it answers your question.
Thanks
Hi, may I know if this issue is already resolved? how?
Your answer is spot on! Follow-up on that, how long before the token expires?
rdewan
April 19, 2023, 10:39am
7
There is proper documentation on the life span of access token and no info on how to set a custom lifetime for access token