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

Better cookie error handling #153

Merged
merged 19 commits into from
Jan 2, 2025
Merged

Better cookie error handling #153

merged 19 commits into from
Jan 2, 2025

Conversation

PaulAsjes
Copy link
Contributor

@PaulAsjes PaulAsjes commented Dec 16, 2024

Fixes #112

Throws if the cookie password is missing or if it's too short.

Also adds a test for the onSuccess handler, which was merged prior to when we had tests for this repo.

@PaulAsjes PaulAsjes changed the title Better cookie error handling [wip] Better cookie error handling Dec 16, 2024
@PaulAsjes PaulAsjes requested a review from mthadley December 27, 2024 14:52
@PaulAsjes PaulAsjes changed the title [wip] Better cookie error handling Better cookie error handling Dec 27, 2024
Copy link
Contributor

@mthadley mthadley left a comment

Choose a reason for hiding this comment

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

LGTM! Just a few test-related nits and suggestions.

__tests__/authkit-callback-route.spec.ts Outdated Show resolved Hide resolved
'You must provide a valid cookie password that is at least 32 characters in the environment variables.',
);

jest.replaceProperty(envVariables, 'WORKOS_COOKIE_PASSWORD', originalWorkosCookiePassword);
Copy link
Contributor

Choose a reason for hiding this comment

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

If you set restoreMocks to true in the Jest config then properties like this will automatically be restored between tests without a need to keep track of original values like this. I think it's a good default behavior to go with.

@PaulAsjes PaulAsjes merged commit a9d77b8 into main Jan 2, 2025
3 checks passed
@PaulAsjes PaulAsjes deleted the pma/cookie-pw-error-handling branch January 2, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Missing cookie password throws a confusing error
2 participants