OpenLinear integrates with GitHub for authentication, repository management, and pull request creation.
OpenLinear supports two authentication methods:
Users can register with email and password via POST /api/auth/register (requires name, email, password). Login via POST /api/auth/login. This is sufficient for basic task management, but GitHub OAuth is needed for repo import, cloning private repos, and PR creation.
- User clicks "Sign in with GitHub" in the sidebar
GET /api/auth/githubredirects to GitHub's authorization page- User authorizes the app (scopes:
read:user user:email repo) - GitHub redirects to
/api/auth/github/callbackwith a code - The API exchanges the code for an access token
- Creates or updates the user record in the database
- Returns a JWT (7-day expiry) via redirect to the frontend
| Variable | Description |
|---|---|
GITHUB_CLIENT_ID |
OAuth app client ID |
GITHUB_CLIENT_SECRET |
OAuth app client secret |
GITHUB_REDIRECT_URI |
Callback URL (default: http://localhost:3001/api/auth/github/callback) |
| Method | Path | Description |
|---|---|---|
GET |
/api/auth/github |
Start OAuth flow |
GET |
/api/auth/github/callback |
Handle OAuth callback |
GET |
/api/auth/me |
Get current user (Bearer token) |
POST |
/api/auth/logout |
Logout (client clears token) |
GET /api/repos/github-- fetch all repos from GitHub (paginated, sorted by updated)POST /api/repos/import-- import a repo into OpenLinearPOST /api/repos/:id/activate-- set as active repositoryGET /api/repos/active-- get current active repositoryGET /api/repos-- list all imported repositories
POST /api/repos/url-- add a public repo by URL- Accepts:
https://github.com/owner/repo,git@github.com:owner/repo, orowner/repo - Fetches metadata from GitHub API
- Rejects private repositories
- Accepts:
POST /api/repos/:id/activate/public-- set active public repositoryGET /api/repos/active/public-- get active public repositoryGET /api/repos/public-- list all public repositories
Public API calls use unauthenticated GitHub API access (60 requests/hour). Set GITHUB_TOKEN in your environment for authenticated access (5000 requests/hour).
When a task execution finishes with changes:
- If the user has a GitHub access token:
POST https://api.github.com/repos/:owner/:repo/pullswith the task title and branch- PR body: task title and description
- Returns the PR URL
- If no token or the API call fails:
- Returns a compare URL:
https://github.com/:owner/:repo/compare/:base...:branch - User can manually create a PR from this link
- Returns a compare URL:
POST /api/tasks/:id/refresh-pr checks whether a PR was created for a task that only has a compare URL. If GitHub returns a PR for that branch, the task's prUrl is updated to the real PR URL. For batch tasks, all tasks in the same batch sharing the old compare URL are updated.