Skip to content

Commit bf646fe

Browse files
committed
reorganize github-auth
1 parent 70c2548 commit bf646fe

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

docs/admin/users/github-auth.md

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,50 @@ to this data by administering the GitHub app.
1616
## Default Configuration
1717

1818
> [!IMPORTANT]
19-
> The default GitHub app requires [device flow](#device-flow) to authenticate.
19+
> The default GitHub app grants Coder access to your organizations' GitHub data.
2020
>
21-
> This is enabled by default when using the default GitHub app.
22-
> If you disable device flow using `CODER_OAUTH2_GITHUB_DEVICE_FLOW=false`, it will be ignored.
21+
> For production environments, we strongly recommend that you
22+
> [configure your own GitHub OAuth app](#step-1-configure-the-oauth-application-in-github)
23+
> to ensure that your data is not shared with Coder (the company).
2324
24-
By default, only the admin user can sign up.
25-
To allow additional users to sign up with GitHub, add the following environment variable:
25+
To use the default configuration:
2626

27-
```env
28-
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
29-
```
27+
1. [Install the GitHub app](https://github.com/apps/coder/installations/select_target)
28+
in any GitHub organization that you want to use with Coder.
3029

31-
[Install the GitHub app](https://github.com/apps/coder/installations/select_target) in every GitHub organization that you need to limit sign ups to.
32-
This will grant Coder, the company, access to your organizations' data as described in the installation flow.
33-
In a production environment, we recommend configuring your own GitHub OAuth app as outlined further below, so all of your data is kept private.
30+
The default GitHub app requires [device flow](#device-flow) to authenticate.
31+
This is enabled by default when using the default GitHub app.
32+
If you disable device flow using `CODER_OAUTH2_GITHUB_DEVICE_FLOW=false`, it will be ignored.
3433

35-
If you'd like to proceed with the default GitHub app, install it in the
36-
organizations you want to limit sign ups to by visiting
37-
[this page](https://github.com/apps/coder/installations/select_target) and set
38-
the following environment variable:
34+
1. By default, only the admin user can sign up.
35+
To allow additional users to sign up with GitHub, add:
3936

40-
```env
41-
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
42-
```
37+
```shell
38+
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
39+
```
40+
41+
1. **Configure Organization Restrictions (Optional)**
42+
If you want to limit sign-ups to specific GitHub organizations, set:
4343

44-
For production deployments, we recommend configuring your own GitHub OAuth app
45-
as outlined below. The default is automatically disabled if you configure your
46-
own app or set:
44+
```shell
45+
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
46+
```
4747

48-
```env
48+
## Disable the Default GitHub App
49+
50+
You can disable the default GitHub app by [configuring your own app](#step-1-configure-the-oauth-application-in-github)
51+
or by adding the following environment variable to your [Coder server configuration](../../reference/cli/server.md#options):
52+
53+
```shell
4954
CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER_ENABLE=false
5055
```
5156

5257
> [!NOTE]
53-
> After you disable the default GitHub provider with the setting above, the
54-
> **Sign in with GitHub** button might still appear on your login page even though
55-
> the authentication flow is disabled.
58+
> After you disable the default GitHub provider, the **Sign in with GitHub** button
59+
> might still appear on your login page even though the authentication flow is disabled.
5660
>
57-
> To completely hide the GitHub sign-in button, you must both disable the default
58-
> provider and ensure you don't have a custom GitHub OAuth app configured.
61+
> To completely hide the GitHub sign-in button, you must disable the default provider
62+
> and ensure you don't have a custom GitHub OAuth app configured.
5963
6064
## Step 1: Configure the OAuth application in GitHub
6165

@@ -95,7 +99,7 @@ Alternatively, if you are running Coder as a system service, you can achieve the
9599
same result as the command above by adding the following environment variables
96100
to the `/etc/coder.d/coder.env` file:
97101

98-
```env
102+
```shell
99103
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
100104
CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
101105
CODER_OAUTH2_GITHUB_CLIENT_ID="8d1...e05"
@@ -105,7 +109,7 @@ CODER_OAUTH2_GITHUB_CLIENT_SECRET="57ebc9...02c24c"
105109
> [!TIP]
106110
> To allow everyone to sign up using GitHub, set:
107111
>
108-
> ```env
112+
> ```shell
109113
> CODER_OAUTH2_GITHUB_ALLOW_EVERYONE=true
110114
> ```
111115
@@ -149,7 +153,7 @@ This is enabled by default for the default GitHub app and cannot be disabled for
149153

150154
For your own custom GitHub OAuth app, you can enable device flow by setting:
151155

152-
```env
156+
```shell
153157
CODER_OAUTH2_GITHUB_DEVICE_FLOW=true
154158
```
155159

0 commit comments

Comments
 (0)