customerRecover, customerReset and invalid type ID!
See original GitHub issueI’m currently implementing a password reset flow, and ran into an issue with the customerReset
mutation. Firing customerRecover
sends an email notification, as expected. I modified the email notification template to point to my server instead, for example http://localhost:3000/reset-password/6655363669/7c4a5966d0901b57ee96af96eddb0eb5-1503254727.
The problem is that customerReset
takes a customer ID, which should be 6655363669
here. But from what I can tell, that’s a Shopify Customer ID, but not necessarily a Shopify Storefront API Customer ID? The exact error I get is “GraphQL error: Variable id of type ID! was provided invalid value”. The docs show an ID that looks like Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=
, and not 6655363669
. Do I need to modify the email notification template? If so, what Liquid template variable(s) do I use to create a correct password reset URL?
An example that includes password recovery would be great, but it also just looks like that mutation is expecting the wrong arguments.
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (1 by maintainers)
Top GitHub Comments
So, I looked for a Liquid variable for just the reset password token and couldn’t find one.
customer.reset_password_url
is used in the ‘Customer account password reset’ email notification template, however that’s undocumented as well.I ended up with this hack:
Which is also fine for right now, but obviously don’t want to rely on this either. Here’s a Shopify forum post I found that’s related to this.
What I’d like to have is access to Liquid variables for the Customer Storefront API ID, and the Customer Reset Password Token.
I’m assuming the
customerActivate
mutation will run into the same issue too. So might be best to also have a Liquid variable for the Customer Activation Token!The quick workaround is to build the encoded ID yourself:
gid://shopify/Customer/6655363669
is the format. Then you Base64 encode it.Warning: do not rely on this long term. These IDs are encoded for a reason because they can change. This is just a quick fix for this.
We’ll have to figure out a proper solution to this.