Skip to content

Authentication API

GET /api/auth

Returns the currently authenticated user’s profile.

Response 200 OK

{
"id": "user_abc123",
"email": "[email protected]",
"name": "Your Name",
"avatar_url": "https://avatars.githubusercontent.com/u/12345"
}

Returns 401 Unauthorized if no valid session exists.

POST /api/auth

Destroys the current session and logs the user out.

Response 200 OK

GET /api/auth/github

Handles both initiating the GitHub OAuth flow and processing the callback. When called without parameters, starts the OAuth flow. When called with an authorization code parameter, completes login.

GET /api/auth/github/device

Starts the GitHub device authorization flow. Returns a device code and verification URL.

GET /api/auth/github/device/poll

Poll for device flow completion after the user has entered their code on GitHub.

GET /api/auth/github/status

Check if the current user has a valid GitHub token connected.

GET /api/auth/google

Handles both initiating the Google OAuth flow and processing the callback. When called without parameters, redirects to Google’s consent screen. When called with a code parameter, completes login and creates a session.