Redirect a shopify graphql password reset url

I am building a headless site with nuxt3 and netlify, I am using shopify for the ecommerce backend.

When you want to reset a password for a customer there is a graphql mutation and that mutation takes in an input of the customer’s email and send an email to the customer.

Once the customer receives the email, and clicks the link “Reset your password” from within the email, they are redirected to the following url:

https://myshop.com/account/reset/6264420774522/ac833781959cb0ae5e5b9061f42016c5-1712571900?syclid=47ba9ab2-0b4e-4e19-9acf-6aa9f5dab072

I am using nuxt3 and the url structure is defined through the pages folder

I have a _redirects file and I cannot get this redirect to work.

https://myshop.com/account/reset/:customerId/:resetToken?syclid=:syclid  https://myshop.com/reset?syclid=:syclid&customerId=:customerId  301!

What I get redirected to is:

https://myshop.com/reset?syclid=:syclid&customerId=6264420774522

I can’t figure this out and it seems I am doing something wrong because I can get resetToken to come through and customerId to come through but syclid is always just :syclid

Check out the Query Parameters section of the Redirect options documentation. They are handled separately so you’ll need something like

/account/reset/:customerId/:resetToken syclid=:syclid  /reset?syclid=:syclid&customerId=:customerId  301!

Yea, that worked. Can you explain why this works because the query parameters docs state

While our service automatically passes on all query string parameters to destination paths for redirects with 200 , 301 , and 302 HTTP status, you can also choose to define a redirect path based on a specific parameter or combination of parameters.

I was under the impression that I was pulling the placeholders off of the original url and using them as query params and that the other query params would be automatically forwarded

My understanding (others can correct me if I am wrong) is that yes, the query parameters would get passed along except that you are overriding this by appending query parameters on the to URL.

So if you had

/account/reset/:customerId/:resetToken  /reset  301!

and went to your original URL

https://myshop.com/…?syclid=47ba9ab2-0b4e-4e19-9acf-6aa9f5dab072

the ?syclid=47ba9ab2-0b4e-4e19-9acf-6aa9f5dab072 would get forwarded.

But because you are writing the URL from /:customerId/ to ?customerId=customerId the original parameter need passing explicitly.

Awesome that does make sense, thanks!

Phew! :sweat:

I had myself worried for a second that it wouldn’t :slightly_smiling_face: