-
-
Notifications
You must be signed in to change notification settings - Fork 455
core: fix oauth callback with mail only #1110
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
Merged
undefined-moe
merged 2 commits into
hydro-dev:master
from
renbaoshuo:fix/oauth-mail-binding
Dec 26, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Oops, something went wrong.
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
🌐 Web query:
Google OAuth email verification guaranteed in access token response💡 Result:
Short answer: No — Google does not guarantee an email_verified field in the access token response. email and email_verified are provided as claims in the ID token (or returned by userinfo when you call the UserInfo endpoint) only if you request the appropriate scope (openid email). You should verify email_verified from the ID token (or the /userinfo response), not from the access token itself. [1][2][3]
Sources:
🌐 Web query:
GitHub OAuth email verification status in API response💡 Result:
Short answer: GitHub returns email verification status only from the Emails API (GET /user/emails) — each email object includes "verified": true|false. The standard user object (GET /user) may include an email field but does not expose a "verified" flag. OAuth tokens must include the user:email (or appropriate fine‑grained "Email addresses") scope to call the Emails endpoints. [1][2]
Sources:
🌐 Web query:
Facebook OAuth email verification guarantee💡 Result:
Short answer: Don’t rely on Facebook Login to guarantee an app-ready, permanently verified email — verify it yourself.
Details: Facebook may return an email via OAuth when the user has one, but the docs and Facebook guidance tell apps to confirm email ownership themselves (e.g., send a verification link) because the email field isn’t always present/guaranteed for every account and practices/fields can vary. [1][2].
If you need a definitive flag you can trust for downstream account actions, send your own confirmation email (or use an IdP-aware user.profile/email_verified field in your identity provider stack). [1][3]
Sources:
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 70
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 1805
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 175
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 2390
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 960
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 3092
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 86
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 41
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 86
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 41
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 41
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 41
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 2756
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 401
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 41
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 84
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 1583
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 41
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 69
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 69
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 4315
🏁 Script executed:
Repository: hydro-dev/Hydro
Length of output: 5364
Validate email verification for providers that support it.
The auto-binding logic trusts the OAuth provider's email claim without verifying it has been confirmed by the provider. Google's ID token includes an
email_verifiedclaim that should be checked before auto-binding; currently, only the email field is used. GitHub's implementation correctly validates theverifiedflag from the Emails API. Add a check forpayload.email_verifiedin the Google provider's callback (aroundlogin-with-google/index.tsline 59-67), or document that only providers with mandatory email verification are configured for auto-binding.🤖 Prompt for AI Agents