Shopify / hydrogen

Hydrogen lets you build faster headless storefronts in less time, on Shopify.
https://hydrogen.shop
MIT License
1.19k stars 241 forks source link

Hydrogen Login Bad redirects #2015

Closed ulysses-ck closed 2 weeks ago

ulysses-ck commented 1 month ago

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2023.10.0

What version of Remix are you using?

2.1.0

Steps to Reproduce

Expected Behavior

Receive the code in non-www-domain.com/account/authorize and logged in successfully.

Actual Behavior

Receive the code in non-www-domain.com/authorize and not logged in.

ulysses-ck commented 1 month ago

I tried also to change the redirect-url param in the url from /authorize to /account/authorize and gives an error about bad authorization.

michenly commented 2 weeks ago

Hi @ulysses-ck, sounds like you are using the old utility we have in @shopify/hydrogen@2023.10.0 which is causing miss-match with our documentation.

The old utility createCustomerClient__unstable is unstable and subject to change. In this utility we hard coded /authorize as redirect-url.

The newer version of hydrogen@2024.1.0 or later has stabilized api and uses /account/authorize as default redirect-url.

I would suggest running npx shopify hydrogen upgrade to update your project to the latest.

But also running npm create @shopify/hydrogen@latest to get the latest skeleton code you can use to copy/view the relevant files for new customer account flows (ie. you would want all the app/routes/account* routes, and also search for customerAccount. for a few other files needed)

ulysses-ck commented 2 weeks ago

I really appreciate it! Thanks, I'll try to update and get everything working again.