Skip to main content
POST
/
auth
/
github
GitHub OAuth
curl --request POST \
  --url https://api.example.com/auth/github \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>"
}
'
{
  "access_token": "<string>",
  "token_type": "<string>",
  "user": {
    "id": 123,
    "login": "<string>",
    "name": "<string>",
    "email": "<string>",
    "avatar_url": "<string>"
  },
  "status_code": 123,
  "detail": "<string>"
}

Overview

This endpoint exchanges a GitHub OAuth authorization code for a Dependify access token. After a user authorizes your application on GitHub, call this endpoint with the returned code to authenticate the user and receive a JWT token for subsequent API requests.

Authentication

No authentication required for this endpoint. However, you must provide a valid GitHub OAuth code.

Rate Limiting

This endpoint is rate-limited to 10 requests per minute per IP address.

Request Body

code
string
required
GitHub OAuth authorization code received from the OAuth callback

Response

access_token
string
JWT access token for authenticating with Dependify API
token_type
string
Token type, always returns "bearer"
user
object
GitHub user information

Example Request

curl -X POST https://api.dependify.dev/auth/github \
  -H "Content-Type: application/json" \
  -d '{
    "code": "gho_abc123xyz789"
  }'

Example Response

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "user": {
    "id": 12345678,
    "login": "octocat",
    "name": "The Octocat",
    "email": "[email protected]",
    "avatar_url": "https://avatars.githubusercontent.com/u/12345678"
  }
}

Error Responses

status_code
integer
HTTP status code indicating the error type
detail
string
Human-readable error message

Common Errors

Token Expiration

JWT tokens issued by this endpoint expire after 24 hours. Store the token securely and include it in the Authorization header for authenticated requests:
Authorization: Bearer <access_token>

OAuth Flow

  1. Redirect user to GitHub OAuth authorization URL:
    https://github.com/login/oauth/authorize?client_id=YOUR_CLIENT_ID&scope=repo,user
    
  2. User authorizes the application and is redirected back with a code parameter
  3. Exchange the code using this endpoint to receive an access token
  4. Use the access token for subsequent API requests

Build docs developers (and LLMs) love