Skip to content

feat(auth): include linked GitHub account id in OAuth id_token - #62

Merged
olleolleolle merged 3 commits into
mainfrom
feature/github-id-id-token
Aug 21, 2026
Merged

feat(auth): include linked GitHub account id in OAuth id_token#62
olleolleolle merged 3 commits into
mainfrom
feature/github-id-id-token

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Summary

Related: codebar/planner#2805.

The planner now matches returning members by the stable GitHub account id when a user's GitHub email differs from their stored planner email (codebar/planner#2806). This change adds that github_id claim to the OAuth id_token so the planner can perform the lookup.

Changes

  • Added src/auth/id-token-claims.js to look up a user's linked GitHub accountId from the Better Auth account table.
  • Configured customIdTokenClaims on the OAuth provider to inject github_id into the id_token.
  • Added integration tests verifying the claim is present for GitHub-linked users and absent for magic-link-only users.

Deployment note

This should be deployed before or alongside codebar/planner#2806. When the claim is absent, the planner falls back to its existing email-based matching.

Post-Deploy Monitoring & Validation

  • Monitor logs for errors from getGithubAccountId after deploy.
  • Verify that planner logins via codebar auth still work.
  • Check that the id_token issued for GitHub-linked users contains a github_id claim.

@mroderick
mroderick force-pushed the feature/github-id-id-token branch from df9a3ce to 83b6160 Compare August 11, 2026 08:40
@mroderick
mroderick marked this pull request as ready for review August 11, 2026 08:45
Comment thread src/auth/id-token-claims.js Outdated
olleolleolle
olleolleolle previously approved these changes Aug 11, 2026

@olleolleolle olleolleolle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it looks lovely.

@till till left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would do min what @olleolleolle said.

Otherwise I wonder if the custom email lookup broke it for many? You got an approval though, maybe still worth a try.

@mroderick
mroderick requested review from olleolleolle and till August 21, 2026 06:10
@olleolleolle
olleolleolle merged commit 4ecfd6d into main Aug 21, 2026
7 checks passed
@olleolleolle
olleolleolle deleted the feature/github-id-id-token branch August 21, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants