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

AuthBypassTokenDuration CLI Additions #2182

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

NelsonLee-Code
Copy link
Contributor

@NelsonLee-Code NelsonLee-Code commented May 31, 2024

WHY are these changes introduced?

Issue: Issue

Added the -auth-bypass-token-duration flag in the Hydrogen CLI to allow developers to extend E2E tests via their auth-bypass-token.

By default, tokens are valid for two hours. You can modify this duration by supplying the --auth-bypass-token-duration flag to the deploy command. The duration can be set to any whole number of hours from 1 to 12.

npx shopify hydrogen deploy --auth-bypass-token --auth-bypass-token-duration=5 --token $SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN

Docs: https://github.com/Shopify/shopify-dev/pull/44952

WHAT is this pull request doing?

  • Adds the -auth-bypass-token-duration flag in the Hydrogen CLI.

HOW to test your changes?

I added the an auth-bypass-token-duration of 5 hours, which succeeded in deploying to Oxygen and the token expires 5 hours from when it was created.

Screenshot 2024-06-06 at 10 58 39 AM Screenshot 2024-06-06 at 10 59 16 AM

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

Copy link
Contributor

shopify bot commented May 31, 2024

Oxygen deployed a preview of your AuthBypassTokenDuration-CLI-Additions branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
optimistic-cart-ui - (Logs) - Inspect deployment May 31, 2024 6:55 PM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment June 7, 2024 2:05 PM

Learn more about Hydrogen's GitHub integration.

@frandiox
Copy link
Contributor

frandiox commented Jun 4, 2024

Please rebase when #2192 is merged 🙏

@NelsonLee-Code NelsonLee-Code force-pushed the AuthBypassTokenDuration-CLI-Additions branch 3 times, most recently from 3b03fc9 to 0c6833b Compare June 6, 2024 17:05
@NelsonLee-Code NelsonLee-Code marked this pull request as ready for review June 6, 2024 17:11
@NelsonLee-Code NelsonLee-Code requested review from graygilmore, aswamy and a team and removed request for graygilmore June 6, 2024 17:11
@NelsonLee-Code NelsonLee-Code self-assigned this Jun 6, 2024
.changeset/young-gifts-learn.md Outdated Show resolved Hide resolved
@@ -226,6 +233,7 @@ export async function runDeploy(
options: OxygenDeploymentOptions,
): Promise<void> {
const {
authBypassTokenDuration: authBypassTokenDuration,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
authBypassTokenDuration: authBypassTokenDuration,
authBypassTokenDuration,

packages/cli/src/commands/hydrogen/deploy.test.ts Outdated Show resolved Hide resolved
@NelsonLee-Code NelsonLee-Code force-pushed the AuthBypassTokenDuration-CLI-Additions branch 2 times, most recently from 494ef9e to 18b11a7 Compare June 6, 2024 18:00
@NelsonLee-Code NelsonLee-Code requested a review from aswamy June 6, 2024 18:00
@graygilmore graygilmore requested a review from a team June 6, 2024 18:49
Copy link
Contributor

@frandiox frandiox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let's wait for the others to review as well 🙏

description:
'Specify the duration (in hours) up to 12 hours for the authentication bypass token. Defaults to `2`',
required: false,
dependsOn: ['auth-bypass-token'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be useful to add an env flag name to both auth-bypass-token and auth-bypass-token-duration so that devs can pass these values from env variables.

authBypassTokenDuration: '2',
};

await runDeploy(params);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get better errors:

Suggested change
await runDeploy(params);
await expect(runDeploy(params)).resolves.not.toThrow();

@NelsonLee-Code NelsonLee-Code force-pushed the AuthBypassTokenDuration-CLI-Additions branch 2 times, most recently from bc133cb to 8f105df Compare June 7, 2024 14:00
@NelsonLee-Code NelsonLee-Code force-pushed the AuthBypassTokenDuration-CLI-Additions branch from 8f105df to e1969ad Compare June 7, 2024 14:03
@NelsonLee-Code NelsonLee-Code merged commit 83cb96f into main Jun 7, 2024
13 checks passed
@NelsonLee-Code NelsonLee-Code deleted the AuthBypassTokenDuration-CLI-Additions branch June 7, 2024 16:54
This was referenced Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants