-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat(next-auth): add legacy flag for v4 compatibility #12825
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a legacy flag to maintain compatibility with v4 behavior alongside the upcoming v5 release. The changes adjust cookie naming, update OAuth callback behavior, and extend configuration types to support the legacy mode.
- Remove duplicate import statements and restructure type declarations.
- Update cookie naming conventions based on legacy mode.
- Amend OAuth handler to conditionally bypass state and PKCE checks when legacy mode is enabled.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/core/src/types.ts | Reorders type imports and adds an optional legacy flag to internal options |
packages/core/src/lib/utils/cookie.ts | Introduces a legacy flag to modify cookie name prefixes accordingly |
packages/core/src/lib/init.ts | Passes the legacy configuration to defaultCookies and opts in legacy behavior |
packages/core/src/lib/actions/callback/oauth/callback.ts | Updates OAuth callback to adjust state validation and PKCE handling for legacy mode |
packages/core/src/index.ts | Adds a legacy flag to AuthConfig to enable legacy mode |
Files not reviewed (1)
- docs/pages/getting-started/migrating-to-v5.mdx: Language not supported
Comments suppressed due to low confidence (1)
packages/core/src/lib/actions/callback/oauth/callback.ts:134
- [nitpick] Consider refactoring the nested ternary logic for 'stateCheck' into a clearer if/else structure or extracting it into a helper function to improve readability and maintainability.
const stateCheck = legacy && !provider.checks.includes("state") ? o.skipStateCheck : provider.checks.includes("state") ? state : o.skipStateCheck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
☕️ Reasoning
🧢 Checklist
🎫 Affected issues
📌 Resources