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

Use new Oxygen variable formats for tokens etc #353

Closed
jplhomer opened this issue Jan 5, 2023 · 3 comments · Fixed by #354
Closed

Use new Oxygen variable formats for tokens etc #353

jplhomer opened this issue Jan 5, 2023 · 3 comments · Fixed by #354

Comments

@jplhomer
Copy link
Contributor

jplhomer commented Jan 5, 2023

Description

Oxygen provides these variables out of the box:

PUBLIC_STOREFRONT_ID
PUBLIC_STOREFRONT_API_TOKEN
PUBLIC_STORE_DOMAIN
PRIVATE_STOREFRONT_API_TOKEN
SESSION_SECRET

We need to update server.ts to use these variable names in our templates so they work out of the box when deployed to Oxygen.

We should also start passing the private API token to the storefront client as well.

@frandiox
Copy link
Contributor

frandiox commented Jan 5, 2023

@jplhomer In /admin for the Hydrogen preview shop I see the old variables (e.g. SHOPIFY_STOREFRONT_API_PUBLIC_TOKEN). Should we update these? Are newly created "Hydrogen Channels" going to create variables without the SHOPIFY_ prefix?

@jplhomer
Copy link
Contributor Author

jplhomer commented Jan 5, 2023

It sounds like the old SHOPIFY_ prefixed ones have been deprecated. We might generate both sets today with the intention of only generating the non-SHOPIFY ones in the future. cc @max611

@max611
Copy link
Member

max611 commented Jan 5, 2023

It's a bit tricky at the moment but here is a breakdown of how it works for now:

Create new storefront: PUBLIC_ variables only
Connect new storefront WITH the hydrogen.config.js file: PUBLIC_ and SHOPIFY_ variables
Connect new storefront WITHOUT the hydrogen.config.js file: PUBLIC_ variables only

If the hydrogen.config.js file is not present, we assume the user is on hydrogen v2.

If the file is present, we assume the user is on Hydrogen v1.x but we don't know the exact version the user is using so we have to create the deprecated and new variables. More context in this issue

The goal is to eventually remove the deprecated values from the connect flow but it will be easier once we launch V2.

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

Successfully merging a pull request may close this issue.

3 participants