[Storefront API] - Help using customerResetByUrl mutations

Highlighted
New Member
3 0 0

Hey everyone,

 

I'm looking for help in using the customerResetByUrl mutation on the Storefront API.

 

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

 

After a bit of debugging, I finally figured out that customerResetByUrl takes the default Shopify password reset URL, also known as the resetUrl. This is the same URL set within the password reset email template. However, I'm confused how this is expected to be used.

 

Is customerResetByUrl intended to be used programmatically? I'm trying to build the password reset flow on my own site without the user going to Shopify at all. So ideally, I'm trying to force the password reset link to point to my own server without modifying the email template. Is this possible?

 

It seems I have no way of accessing resetUrl via the API. The only place I see resetUrl is within the password reset email. There must be something I'm missing, otherwise how would you even use this mutation without access to resetUrl?

 

Any direction would be much appreciated!

0 Likes
New Member
3 0 0

Really need some help here, any thoughts?

0 Likes
Shopify Staff
Shopify Staff
125 2 9

Hi @andrewrobbins 

 

You are on the right track. In order to get the reset URL to point to your app you will need to modify the liquid template. Can I ask why you would like to avoid doing this? That way, you can redirect the customer to the proper link. 

 

The flow would be similar to the following: 

 

    1. customer recovers password via customerRecover mutation
    2. customerRecover mutation sends an email to them with reset instructions
    3. the email template is customized to redirect to their site, passing the id and reset token from liquid. You can use  customer.reset_password_url liquid variable.
    4. Then you are able to use the customerResetByUrl  mutation

 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


1 Like
New Member
3 0 0

Hey @vix 

 

Thanks for the response!

 

I'm doing exactly the steps you listed and it's working great as is.

 

The reason I'd like to eliminate the liquid modification step is because my app requires end users to make this tweak on their ownmany of whom are without any developer experience.

 

I could create a tutorial in my documentation, but it would really improve the UX flow of using my product if I could just handle it for them programmatically.

 

Perhaps an API endpoint that would allow me to filter the domain of the customer.reset_password_url value directly?

0 Likes
Shopify Staff
Shopify Staff
125 2 9

Hey @andrewrobbins As i'm sure you know - the format of the URL is your-domain.com/account/reset/{{ customer-id }}/{{ reset-token }} at this time there is no way to pull this from the API, however, I will pass along your feedback with the use case. 

 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes