Initiate GitHub Login
GET /auth/github
Authentication: None required
Flow
- Generates a cryptographically secure random
statetoken - Stores state in database with 10-minute expiration
- Redirects to GitHub with client ID, scopes, and state
Redirect URL
GitHub OAuth Callback
Method:GET /auth/github/callback
Authentication: None required (validates state parameter)
Authorization code from GitHub
CSRF protection token (must match server-stored state)
Response
Redirects to{FRONTEND_URL}/dashboard with JWT cookie set.
Cookie Set
Error Responses
Error message
- 400: Invalid or expired OAuth state
- 400: Failed to exchange GitHub code
- 400: Failed to fetch GitHub user
Get Current User
GET /auth/me
Authentication: Required (JWT cookie)
Response
Internal user ID
GitHub user ID
GitHub username
User’s display name from GitHub
Primary email address
GitHub avatar URL
ISO 8601 timestamp of first login
Example Response
Logout
POST /auth/logout
Authentication: None required (clears cookie regardless)
Response
access_token cookie is deleted from the client.
Notes
- Does not revoke the GitHub access token (user can manually revoke in GitHub settings)
- Clears the JWT cookie only; does not delete user from database