Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydrogen Login Bad redirects #2015

Closed
ulysses-ck opened this issue Apr 17, 2024 · 3 comments
Closed

Hydrogen Login Bad redirects #2015

ulysses-ck opened this issue Apr 17, 2024 · 3 comments

Comments

@ulysses-ck
Copy link

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

  • npm create @shopify/hydrogen
  • Setup custom non-www domain for hydrogen and www domain for store online
  • Setup Routes of auth and file server.js
    • /account/login
    • /account/logout
    • /account/authorize
  • Run ngrok or npx shopify hydrogen dev --customer-account-push__unstable
  • Go to [domain-development]/account/login
  • Create an account, puts the token

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
Copy link
Author

ulysses-ck commented Apr 17, 2024

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
Copy link
Contributor

michenly commented May 2, 2024

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)

@michenly michenly closed this as completed May 2, 2024
@ulysses-ck
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants