Skip to content

feat(server): add GitHub OAuth provider#16

Merged
jgpruitt merged 1 commit into
mainfrom
feature/server-oauth-github
Apr 7, 2026
Merged

feat(server): add GitHub OAuth provider#16
jgpruitt merged 1 commit into
mainfrom
feature/server-oauth-github

Conversation

@jgpruitt

@jgpruitt jgpruitt commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add GitHub OAuth provider implementation for device flow authentication
  • GitHub tokens don't expire (no refresh token unlike Google)
  • Fetch primary email from /user/emails endpoint when email is not public on profile

Changes

  • New file: packages/server/auth/providers/github.ts

    • getGitHubConfig() - returns client ID and scopes (read:user, user:email)
    • buildGitHubAuthUrl() - constructs GitHub authorization URL
    • exchangeGitHubCode() - exchanges authorization code for access token
    • fetchGitHubUserInfo() - fetches user profile and email
    • fetchGitHubPrimaryEmail() - helper to get primary email from emails endpoint
  • Updated: packages/server/auth/providers/index.ts

    • Route all provider switch statements to GitHub functions
  • Updated: packages/server/handlers/auth.ts

    • Remove "GitHub not implemented yet" error check

Testing

All 234 existing tests pass. The OAuth callback handler was already generic enough to handle both providers - no changes needed there.

Notes

  • GitHub OAuth apps (vs GitHub Apps) don't provide refresh tokens
  • GitHub access tokens don't expire unless explicitly revoked
  • The expiresAt field is set to null for GitHub tokens to reflect this

- Add github.ts with OAuth implementation for GitHub
- GitHub tokens don't expire (no refresh token support)
- Fetch primary email from /user/emails if not public
- Update provider registry to route to GitHub functions
- Remove 'not implemented' check from device code handler
@jgpruitt jgpruitt merged commit ef3b6c7 into main Apr 7, 2026
2 checks passed
@jgpruitt jgpruitt deleted the feature/server-oauth-github branch April 7, 2026 20:34
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.

1 participant