-
Notifications
You must be signed in to change notification settings - Fork 62
fix(oauth): drop partitioned: true and use sameSite: "lax" cookies
#322
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
Open
milehighideas
wants to merge
1
commit into
get-convex:main
Choose a base branch
from
milehighideas:fix/mobile-oauth-cookies
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 12426
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 6617
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 2724
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 1658
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 4171
🌐 Web query:
@auth/core Apple provider response_mode form_post💡 Result:
For Sign in with Apple, when you request
nameand/oremail, Apple returns the authorization response by POSTing a form (application/x-www-form-urlencoded) to yourredirect_uri, so you must setresponse_mode=form_post(instead of the usual query redirect). [1][2]In @auth/core (Auth.js), configure the Apple provider like this:
Also ensure your callback endpoint (e.g.
/api/auth/callback/apple) accepts POST requests and can read form-urlencoded bodies, since Apple willform_postthe response to it. [1][3]Sources:
[1] Apple Developer Documentation (Sign in with Apple authorization request) (developer.apple.com)
[2] OpenAuth Apple provider docs (form_post requirement) (openauth.js.org)
[3] Arctic “Apple” provider notes (Apple posts callback) (v1.arcticjs.dev)
Citations:
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 1310
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 1861
🏁 Script executed:
Repository: get-convex/convex-auth
Length of output: 1956
sameSite: "lax"will break POST-based OAuth callbacks (e.g., Apple Sign In).Per the
sameSitecookie specification,"lax"cookies are not sent on cross-site POST requests. Apple Sign In usesresponse_mode=form_postby default (standard behavior from@auth/core), which means Apple POSTs the authorization response to your callback endpoint. WithsameSite="lax", the PKCEcode_verifier,state, andnoncecookies—which are required byhandleOAuthto verify the callback—won't be present, causing the callback to fail.The code in
src/server/implementation/index.ts(lines 309–318) explicitly handles POST requests with a comment noting support for providers like Apple, but the cookie policy undermines this.Consider one of these alternatives:
sameSiteto"none"and ensuresecure: trueis set (which it is)🤖 Prompt for AI Agents