@@ -1,53 +1,64 @@
# GitHub
## Default Configuration
By default, new Coder deployments use a Coder-managed GitHub app to authenticate
users. We provide it for convenience, allowing you to experiment with Coder
without setting up your own GitHub OAuth app. Once you authenticate with it, you
grant Coder server read access to:
users.
We provide it for convenience, allowing you to experiment with Coder
without setting up your own GitHub OAuth app.
- Your GitHub user email
- Your GitHub organization membership
- Other metadata listed during the authentication flow
If you authenticate with it, you grant Coder server read access to your GitHub
user email and other metadata listed during the authentication flow.
This access is necessary for the Coder server to complete the authentication
process. To the best of our knowledge, Coder, the company, does not gain access
process.
To the best of our knowledge, Coder, the company, does not gain access
to this data by administering the GitHub app.
## Default Configuration
> [!IMPORTANT]
> The default GitHub app requires [device flow](#device-flow) to authenticate.
> This is enabled by default when using the default GitHub app. If you disable
> device flow using `CODER_OAUTH2_GITHUB_DEVICE_FLOW=false`, it will be ignored.
> Installation of the default GitHub app grants Coder (the company) access to your organization's GitHub data.
>
> For production environments, we strongly recommend that you
> [configure your own GitHub OAuth app](#step-1-configure-the-oauth-application-in-github)
> to ensure that your data is not shared with Coder (the company).
By default, only the admin user can sign up. To allow additional users to sign
up with GitHub, add the following environment variable:
To use the default configuration:
```env
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
```
1. [Install the GitHub app](https://github.com/apps/coder/installations/select_target)
in any GitHub organization that you want to use with Coder.
To limit sign ups to members of specific GitHub organizations, set:
The default GitHub app requires [device flow](#device-flow) to authenticate.
This is enabled by default when using the default GitHub app.
If you disable device flow using `CODER_OAUTH2_GITHUB_DEVICE_FLOW=false`, it will be ignored.
```env
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
```
1. By default, only the admin user can sign up.
To allow additional users to sign up with GitHub, add:
For production deployments, we recommend configuring your own GitHub OAuth app
as outlined below. The default is automatically disabled if you configure your
own app or set:
```shell
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
```
```env
1. (Optional) If you want to limit sign-ups to specific GitHub organizations, set:
```shell
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
```
## Disable the Default GitHub App
You can disable the default GitHub app by [configuring your own app](#step-1-configure-the-oauth-application-in-github)
or by adding the following environment variable to your [Coder server configuration](../../reference/cli/server.md#options):
```shell
CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER_ENABLE=false
```
> [!NOTE]
> After you disable the default GitHub provider with the setting above, the
> **Sign in with GitHub** button might still appear on your login page even though
> the authentication flow is disabled.
> After you disable the default GitHub provider, the **Sign in with GitHub** button
> might still appear on your login page even though the authentication flow is disabled.
>
> To completely hide the GitHub sign-in button, you must both disable the default
> provider and ensure you don't have a custom GitHub OAuth app configured.
> To completely hide the GitHub sign-in button, you must disable the default provider
> and ensure you don't have a custom GitHub OAuth app configured.
## Step 1: Configure the OAuth application in GitHub
Expand Down
Expand Up
@@ -87,7 +98,7 @@ Alternatively, if you are running Coder as a system service, you can achieve the
same result as the command above by adding the following environment variables
to the `/etc/coder.d/coder.env` file:
```env
```shell
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
CODER_OAUTH2_GITHUB_CLIENT_ID="8d1...e05"
Expand All
@@ -97,7 +108,7 @@ CODER_OAUTH2_GITHUB_CLIENT_SECRET="57ebc9...02c24c"
> [!TIP]
> To allow everyone to sign up using GitHub, set:
>
> ```env
> ```shell
> CODER_OAUTH2_GITHUB_ALLOW_EVERYONE=true
> ```
Expand Down
Expand Up
@@ -129,23 +140,24 @@ To upgrade Coder, run:
helm upgrade <release-name> coder-v2/coder -n <namespace> -f values.yaml
```
We recommend requiring and auditing MFA usage for all users in your GitHub
organizations. This can be enforced from the organization settings page in the
"Authentication security" sidebar tab.
We recommend requiring and auditing MFA usage for all users in your GitHub organizations.
This can be enforced from the organization settings page in the **Authentication security** sidebar tab.
## Device Flow
Coder supports
[device flow](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#device-flow)
for GitHub OAuth. This is enabled by default for the default GitHub app and cannot be disabled
for that app. For your own custom GitHub OAuth app, you can enable device flow by setting:
for GitHub OAuth.
This is enabled by default for the default GitHub app and cannot be disabled for that app.
```env
For your own custom GitHub OAuth app, you can enable device flow by setting:
```shell
CODER_OAUTH2_GITHUB_DEVICE_FLOW=true
```
Device flow is optional for custom GitHub OAuth apps. We generally recommend using
the standard OAuth flow instead, as it is more convenient for end users.
Device flow is optional for custom GitHub OAuth apps.
We generally recommend using the standard OAuth flow instead, as it is more convenient for end users.
> [!NOTE]
> If you're using the default GitHub app, device flow is always enabled regardless of
Expand Down
Uh oh!
There was an error while loading. Please reload this page.