The GitHub Gatekeeper connects Cloudflare OS to GitHub via OAuth, enabling agents and Gadgets to read repositories, browse issues, review pull requests, and act on your behalf — all within the narrow access scope you define. It also powers “Continue with GitHub” sign-in when enabled, using the minimal scopes required to read your verified email without granting full repository access at login time.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/cloudflare-os/llms.txt
Use this file to discover all available pages before exploring further.
Capabilities
The GitHub Gatekeeper serves two distinct roles depending on how a user interacts with it.- Sign-in
- Connections
When
github is included in the deployment’s AUTH_GATEKEEPERS allowlist, a “Continue with GitHub” button appears on the login page.- Scopes requested:
read:user user:email - Purpose: reads the account’s primary verified email to establish the user’s identity
- Grant lifetime: transient — the token is discarded immediately after the email is read
Resource Types
| Resource | URL pattern | What agents can do |
|---|---|---|
| Repository | https://github.com/:owner/:repo | Read code, list branches, read file contents |
| Issue | https://github.com/:owner/:repo/issues/:number | Read, comment, update labels |
| Pull Request | https://github.com/:owner/:repo/pull/:number | Read diff, comments, review status |
Prerequisites
You will need:- A GitHub account with access to Developer Settings
- The
PUBLIC_BASE_URLof your Cloudflare OS deployment (e.g.,https://os.example.comorhttp://localhost:8787for local dev)
Setup
Create a GitHub OAuth App
- Go to GitHub Settings → Developer settings → OAuth Apps — choose OAuth Apps, not “GitHub Apps”.
- Click New OAuth App.
-
Fill in the application details:
- Application name: anything descriptive (e.g., “My Company OS”)
- Homepage URL: your
PUBLIC_BASE_URL - Authorization callback URL:
${PUBLIC_BASE_URL}/gatekeeper/github/oauth
http://localhost:8787/gatekeeper/github/oauth. - Click Register application.
Generate a client secret
On the app’s settings page after registration:
- Click Generate a new client secret.
- Copy both the Client ID and the generated Client secret — you will need both in the next step.
Configure credentials
Create a
.env file in the gatekeeper package directory:packages/gatekeeper-github/.env
The
.env file is gitignored and should never be committed to source control.Enable GitHub sign-in (optional)
To show “Continue with GitHub” on the login page, add The order of values controls the order of the login buttons. No additional GitHub configuration is needed — the
github to the AUTH_GATEKEEPERS allowlist in your root .dev.vars (local) or deployment environment:.dev.vars
user:email scope is automatically requested for OAuth Apps.Verify the setup
- Start the application in dev mode (
pnpm dev-server+pnpm dev-client). - Create or open a Gadget and navigate to the Connections tab.
- Click + New Connection and choose a GitHub resource type.
- If prompted, connect a GitHub account — you will be redirected to GitHub’s authorization page.
- After granting access, the tab closes and you are back in the Gadget.
- Use the picker to choose the repository, issue, or pull request to connect.
What Agents Can Do
Once a GitHub resource is introduced to an agent or Gadget, the agent can:- Read repository contents — browse files, read source code, check recent commits
- List and read issues — search open issues, read issue bodies and comments
- List and read pull requests — read diffs, review comments, check CI status
- Create issues — draft a new issue with a title and body (queued for approval)
- Comment on issues and PRs — post a comment on behalf of the connected user (queued for approval)
All write actions — creating issues, posting comments — go through the approval queue before reaching GitHub. The agent continues working on subsequent steps while the action waits for your review.
Using a GitHub App Instead
If you must use a GitHub App (client ID starting withIv…), be aware of the following limitations:
- GitHub Apps ignore the
scopeparameter. Permissions are fixed in the App’s configuration and apply to every user authorization, so sign-in cannot be restricted to minimal scopes. - To read the user’s email for sign-in, you must grant the App the Email addresses account permission: App Settings → Permissions & events → Account permissions → Email addresses → Read-only → save. Existing users must re-authorize to approve the added permission.
- Without the Email addresses permission, the email lookup fails with
Resource not accessible by integrationand sign-in is rejected.
Troubleshooting
"Resource not accessible by integration" error
"Resource not accessible by integration" error
You are using a GitHub App that lacks the Email addresses account permission. Switch to an OAuth App (recommended) or grant the App the Email addresses permission and ask existing users to re-authorize.
"redirect_uri_mismatch" error
"redirect_uri_mismatch" error
The callback URL in your OAuth App settings does not match what the application is sending. Verify it is set to exactly
http://localhost:8787/gatekeeper/github/oauth — no trailing slash, http not https for local dev."bad_verification_code" error
"bad_verification_code" error
The authorization code has expired or was already used. Return to Cloudflare OS and try connecting again.
"Not configured" page during authorization
"Not configured" page during authorization