Skip to main content
GitHub Desktop provides deep integration with GitHub.com and GitHub Enterprise Server through OAuth authentication and the GitHub REST API.

OAuth Authentication

GitHub Desktop uses the OAuth web application flow to authenticate users and perform actions on their behalf.

OAuth Scopes

The application requests the following OAuth scopes:
  • repo - Full control of private repositories
  • user - Read/write access to profile info
  • workflow - Update GitHub Action workflows
app/src/lib/api.ts

Client Credentials

For development and testing, GitHub Desktop includes bundled OAuth credentials. In production, you can provide your own:
The bundled developer OAuth application will not work with GitHub Enterprise. You must provide your own credentials for Enterprise instances.

API Client

The API class provides methods for interacting with GitHub’s REST API:
app/src/lib/api.ts

Authentication Keys

Account authentication keys are stored securely using the operating system’s credential manager:
app/src/lib/auth.ts

Repository Operations

Fetching Repository Information

1

Fetch repository details

Use the fetchRepository method to get repository metadata:
2

Access repository properties

The response includes:
  • Clone URLs (HTTPS and SSH)
  • Default branch
  • Fork status
  • Permissions
  • Archive status
3

Clone with preferred protocol

Creating Repositories

app/src/lib/api.ts

Pull Request Integration

Fetching Pull Requests

GitHub Desktop efficiently fetches pull requests using pagination:
app/src/lib/api.ts

Incremental Updates

For repositories with many PRs, GitHub Desktop uses an intelligent pagination strategy that ramps up page size:
The pagination algorithm starts with a page size of 10 and doubles it when appropriate, up to the maximum of 100 items per page. This optimizes for both small updates (fewer changed PRs) and large updates (many changed PRs).
app/src/lib/api.ts

Pull Request Details

The API provides comprehensive PR information:
app/src/lib/api.ts

Issue Management

Fetching Issues

Retrieve issues with filtering by state and date:
app/src/lib/api.ts

Fetching Comments

Check Runs and Status

Combined Status

Fetch the combined status for a commit reference:
app/src/lib/api.ts

Check Runs

Retrieve GitHub Actions check runs:
app/src/lib/api.ts

Branch Protection

Push Control

Check if a user can push to a protected branch:
app/src/lib/api.ts
allow_actor is always true for repository admins, even if push restrictions are enabled.

Repository Rules

Fetch repository rules that apply to a specific branch:
Supported rule types include:
  • creation - Branch creation rules
  • update - Update restrictions
  • required_status_checks - Required CI checks
  • pull_request - PR requirements
  • commit_message_pattern - Commit message validation
  • required_signatures - Signed commit requirements

Error Handling

The API includes comprehensive error handling and token invalidation callbacks:
app/src/lib/api.ts

Related Documentation

Learn more about GitHub’s API in the GitHub REST API documentation.