headless customer login

Solved
Tourist
11 0 0
Hi All,


I am creating a headless app using nuxt.js. I have sucessfully used graphql API to retrive prodicuts/collections etc, but now I need to create a login so that users can login and can view their orders.

 

I have a form set up, containing the email address and password fields, but not really sure how to proceed forwards. 

How is this achieved using mutation in the grapql API? I can see their is a CustomerAccessToken object.

https://help.shopify.com/en/api/storefront-api/reference/object/customeraccesstoken

 

Thanks

0 Likes

Success.

New Member
2 1 1

You can get a token by submitting that information to customerAccessTokenCreate

 

Docs: https://help.shopify.com/en/api/storefront-api/reference/mutation/customeraccesstokencreate

 

That token can be used to retrieve customer data, associate checkouts, etc

1 Like
Tourist
11 0 0

Thanks! Does this token also log the customer in? or does it simply provide a token which you can then pass to another mutation?

0 Likes
Highlighted
Shopify Partner
3 0 1

Using the token in queries/mutations *is* the session, store it client side.

1 Like