Forge OAuth2 Setup
Crow authenticates users via OAuth2 from a Git forge. Each forge requires creating an OAuth application that Crow uses to authenticate users and access repositories.
The callback/redirect URL for all forges is:
https://<your-crow-domain>/authorizeReplace <your-crow-domain> with your actual Crow instance URL (e.g., ci.example.com).
For local development, use http://localhost:8000/authorize.
Forgejo / Gitea
Section titled “Forgejo / Gitea”Forgejo and Gitea share the same OAuth2 setup process. This also applies to hosted instances like Codeberg and Codefloe.
-
Log in to your Forgejo/Gitea instance and go to Settings (click your avatar in the top-right corner).
-
Select Applications from the sidebar.
-
Under Manage OAuth2 Applications, fill in the form:
- Application Name:
Crow CI(or any name you prefer) - Redirect URI:
https://<your-crow-domain>/authorize - Leave Confidential Client checked (default)
- Application Name:
-
Click Create Application.
-
Copy the Client ID and Client Secret shown on the next page. The secret is only displayed once — copy it immediately.
-
Configure Crow with the credentials:
Single forge:
Terminal window CROW_FORGEJO=trueCROW_FORGEJO_URL=https://codefloe.com # or your instance URLCROW_FORGEJO_CLIENT=<client-id>CROW_FORGEJO_SECRET=<client-secret>Multi-forge:
Terminal window CROW_FORGES=codefloeCROW_FORGE_CODEFLOE_TYPE=forgejoCROW_FORGE_CODEFLOE_URL=https://codefloe.comCROW_FORGE_CODEFLOE_CLIENT=<client-id>CROW_FORGE_CODEFLOE_SECRET=<client-secret>
GitHub
Section titled “GitHub”-
Go to github.com/settings/developers (or Settings → Developer settings → OAuth Apps from your profile).
-
Click New OAuth App.
-
Fill in the application details:
- Application name:
Crow CI - Homepage URL:
https://<your-crow-domain> - Authorization callback URL:
https://<your-crow-domain>/authorize
- Application name:
-
Click Register application.
-
On the application page, copy the Client ID.
-
Click Generate a new client secret and copy the secret. The secret is only displayed once — copy it immediately.
-
Configure Crow with the credentials:
Single forge:
Terminal window CROW_GITHUB=trueCROW_GITHUB_CLIENT=<client-id>CROW_GITHUB_SECRET=<client-secret>Multi-forge:
Terminal window CROW_FORGES=githubCROW_FORGE_GITHUB_TYPE=githubCROW_FORGE_GITHUB_CLIENT=<client-id>CROW_FORGE_GITHUB_SECRET=<client-secret>
GitHub Enterprise
Section titled “GitHub Enterprise”For GitHub Enterprise, additionally set the forge URL:
# Single forgeCROW_FORGE_URL=https://github.example.com
# Multi-forgeCROW_FORGE_GITHUB_URL=https://github.example.comOAuth Scopes
Section titled “OAuth Scopes”Crow requests the following GitHub OAuth scopes:
| Scope | Purpose |
|---|---|
repo | Full access to repositories (webhooks, statuses, content) |
user:email | Read user email addresses |
read:org | Read organization membership |
When CROW_GITHUB_PUBLIC_ONLY=true is set, Crow requests reduced scopes instead of repo:
| Scope | Purpose |
|---|---|
admin:repo_hook | Manage repository webhooks |
repo:status | Access commit status API |
GitLab
Section titled “GitLab”-
Go to gitlab.com/-/user_settings/applications (or Edit profile → Applications from your avatar menu).
-
Click Add new application.
-
Fill in the application details:
- Name:
Crow CI - Redirect URI:
https://<your-crow-domain>/authorize - Confidential: Yes (checked)
- Scopes: Select
api
- Name:
-
Click Save application.
-
Copy the Application ID (this is the Client ID) and Secret.
-
Configure Crow with the credentials:
Single forge:
Terminal window CROW_GITLAB=trueCROW_GITLAB_CLIENT=<application-id>CROW_GITLAB_SECRET=<secret>Multi-forge:
Terminal window CROW_FORGES=gitlabCROW_FORGE_GITLAB_TYPE=gitlabCROW_FORGE_GITLAB_CLIENT=<application-id>CROW_FORGE_GITLAB_SECRET=<secret>
Self-Hosted GitLab
Section titled “Self-Hosted GitLab”For self-hosted GitLab, additionally set the forge URL:
# Single forgeCROW_FORGE_URL=https://gitlab.example.com
# Multi-forgeCROW_FORGE_GITLAB_URL=https://gitlab.example.comOAuth Scopes
Section titled “OAuth Scopes”Crow requests the api scope, which grants full API access including reading user info, managing repositories, and setting commit statuses.
Bitbucket Cloud
Section titled “Bitbucket Cloud”-
Go to your Workspace settings in Bitbucket (click your workspace name → Settings).
-
Under Apps and features, select OAuth consumers.
-
Click Add consumer.
-
Fill in the consumer details:
- Name:
Crow CI - Callback URL:
https://<your-crow-domain>/authorize - Permissions: Select the following:
- Account: Read
- Repositories: Read, Write
- Pull requests: Read, Write
- Webhooks: Read and write
- Name:
-
Click Save.
-
Copy the Key (this is the Client ID) and Secret.
-
Configure Crow with the credentials:
Single forge:
Terminal window CROW_BITBUCKET=trueCROW_BITBUCKET_CLIENT=<key>CROW_BITBUCKET_SECRET=<secret>Multi-forge:
Terminal window CROW_FORGES=bitbucketCROW_FORGE_BITBUCKET_TYPE=bitbucketCROW_FORGE_BITBUCKET_CLIENT=<key>CROW_FORGE_BITBUCKET_SECRET=<secret>
Bitbucket Data Center / Server
Section titled “Bitbucket Data Center / Server”-
Log in to your Bitbucket Data Center instance as an administrator.
-
Go to Administration → Application Links.
-
Click Create link.
-
Select External application and Incoming direction.
-
Fill in the details:
- Name:
Crow CI - Redirect URL:
https://<your-crow-domain>/authorize - Application permissions: Select
REPO_READ,REPO_WRITE, andREPO_ADMIN
- Name:
-
Click Save and copy the Client ID and Client Secret.
-
Configure Crow with the credentials:
Single forge:
Terminal window CROW_BITBUCKET_DC=trueCROW_FORGE_URL=https://bitbucket.example.comCROW_BITBUCKET_DC_CLIENT=<client-id>CROW_BITBUCKET_DC_SECRET=<client-secret>CROW_BITBUCKET_DC_GIT_USERNAME=<service-account-username>CROW_BITBUCKET_DC_GIT_PASSWORD=<service-account-password>Multi-forge:
Terminal window CROW_FORGES=bitbucket-dcCROW_FORGE_BITBUCKET_DC_TYPE=bitbucket-dcCROW_FORGE_BITBUCKET_DC_URL=https://bitbucket.example.comCROW_FORGE_BITBUCKET_DC_CLIENT=<client-id>CROW_FORGE_BITBUCKET_DC_SECRET=<client-secret>CROW_FORGE_BITBUCKET_DC_GIT_USERNAME=<service-account-username>CROW_FORGE_BITBUCKET_DC_GIT_PASSWORD=<service-account-password>
Troubleshooting
Section titled “Troubleshooting””Invalid redirect URI” error
Section titled “”Invalid redirect URI” error”Ensure the redirect URI in your OAuth application exactly matches https://<your-crow-domain>/authorize.
Common mistakes:
- Missing trailing
/authorize - Using
httpinstead ofhttps(or vice versa) - Including a trailing slash after
/authorize - Domain mismatch between
CROW_HOSTand the OAuth redirect URI
”OAuth client ID/secret” errors
Section titled “”OAuth client ID/secret” errors”Verify that:
- The client ID and secret are correctly copied (no extra whitespace)
- The correct forge driver is enabled (e.g.,
CROW_FORGEJO=truenotCROW_GITEA=truefor Forgejo) - For multi-forge setups, the forge name in env vars matches the name in
CROW_FORGES
Self-hosted forge behind a proxy
Section titled “Self-hosted forge behind a proxy”If your forge uses a different public URL than its internal URL, set the OAuth host explicitly:
# Single forgeCROW_EXPERT_FORGE_OAUTH_HOST=https://git.public.example.com
# Multi-forgeCROW_FORGE_{NAME}_OAUTH_HOST=https://git.public.example.comSee Forge Integration for all available environment variables.