GitHub OAuth
Sign in with GitHub.
Most useful for developer-focused apps.
Server config
GitHub OAuth uses the standard OAuth 2.0 authorization-code flow. The library exchanges the code server-side using the client secret — your client never sees the secret.
Endpoint
| Method | Path | Body |
|---|---|---|
POST | /auth/login | { providerName: 'github', credentials: { token } } |
Where token is either:
- The OAuth access token (if you completed the OAuth dance on the frontend), or
- The authorization code (the library will exchange it).
Client call
The simplest path is to do the redirect yourself, then send the resulting code/token to the backend:
What the library does
- Calls GitHub's
/login/oauth/access_tokenendpoint with the code (if you sent a code). - Calls
https://api.github.com/userandhttps://api.github.com/user/emailswith the access token. - Picks the primary verified email.
- Looks up or creates the user, same as Google.