headless customer login

Solved

headless customer login

kapilgohil
Shopify Partner
15 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

Accepted Solution (1)

Switchmode
Shopify Partner
4 1 1

This is an accepted solution.

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

View solution in original post

Replies 6 (6)

Switchmode
Shopify Partner
4 1 1

This is an accepted solution.

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

kapilgohil
Shopify Partner
15 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?

SwitchmodeNZ
Shopify Partner
4 0 1

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

AlexBoy
Shopify Partner
27 0 10

can we implement JWT based on returned customerAccessToken ?
If possible, how to do this

duveral
Shopify Partner
3 0 0

Hi! Could yo expand that? The access token provided is not valid to log in the user, but only to perform mutations. Any alternative?

duveral
Shopify Partner
3 0 0

Did you find a solution? Same issue, the token is only useful for mutations.