1
1
# GitHub
2
2
3
- ## Default Configuration
4
-
5
3
By default, new Coder deployments use a Coder-managed GitHub app to authenticate
6
- users. We provide it for convenience, allowing you to experiment with Coder
7
- without setting up your own GitHub OAuth app. Once you authenticate with it, you
8
- grant Coder server read access to:
4
+ users.
5
+ We provide it for convenience, allowing you to experiment with Coder
6
+ without setting up your own GitHub OAuth app.
9
7
10
- - Your GitHub user email
11
- - Your GitHub organization membership
12
- - Other metadata listed during the authentication flow
8
+ If you authenticate with it, you grant Coder server read access to your GitHub
9
+ user email and other metadata listed during the authentication flow.
13
10
14
11
This access is necessary for the Coder server to complete the authentication
15
- process. To the best of our knowledge, Coder, the company, does not gain access
12
+ process.
13
+ To the best of our knowledge, Coder, the company, does not gain access
16
14
to this data by administering the GitHub app.
17
15
16
+ ## Default Configuration
17
+
18
18
> [ !IMPORTANT]
19
- > The default GitHub app requires [ device flow] ( #device-flow ) to authenticate.
20
- > This is enabled by default when using the default GitHub app. If you disable
21
- > device flow using ` CODER_OAUTH2_GITHUB_DEVICE_FLOW=false ` , it will be ignored.
19
+ > Installation of the default GitHub app grants Coder (the company) access to your organization's GitHub data.
20
+ >
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).
22
24
23
- By default, only the admin user can sign up. To allow additional users to sign
24
- up with GitHub, add the following environment variable:
25
+ To use the default configuration:
25
26
26
- ``` env
27
- CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
28
- ```
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.
29
29
30
- To limit sign ups to members of specific GitHub organizations, set:
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.
31
33
32
- ``` env
33
- CODER_OAUTH2_GITHUB_ALLOWED_ORGS="your-org"
34
- ```
34
+ 1 . By default, only the admin user can sign up.
35
+ To allow additional users to sign up with GitHub, add:
36
+
37
+ ``` shell
38
+ CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
39
+ ```
35
40
36
- For production deployments, we recommend configuring your own GitHub OAuth app
37
- as outlined below. The default is automatically disabled if you configure your
38
- own app or set:
41
+ 1 . (Optional) If you want to limit sign-ups to specific GitHub organizations, set:
39
42
40
- ``` env
43
+ ``` shell
44
+ CODER_OAUTH2_GITHUB_ALLOWED_ORGS=" your-org"
45
+ ```
46
+
47
+ ## Disable the Default GitHub App
48
+
49
+ You can disable the default GitHub app by [ configuring your own app] ( #step-1-configure-the-oauth-application-in-github )
50
+ or by adding the following environment variable to your [ Coder server configuration] ( ../../reference/cli/server.md#options ) :
51
+
52
+ ``` shell
41
53
CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER_ENABLE=false
42
54
```
43
55
44
56
> [ !NOTE]
45
- > After you disable the default GitHub provider with the setting above, the
46
- > ** Sign in with GitHub** button might still appear on your login page even though
47
- > the authentication flow is disabled.
57
+ > After you disable the default GitHub provider, the ** Sign in with GitHub** button
58
+ > might still appear on your login page even though the authentication flow is disabled.
48
59
>
49
- > To completely hide the GitHub sign-in button, you must both disable the default
50
- > provider and ensure you don't have a custom GitHub OAuth app configured.
60
+ > To completely hide the GitHub sign-in button, you must disable the default provider
61
+ > and ensure you don't have a custom GitHub OAuth app configured.
51
62
52
63
## Step 1: Configure the OAuth application in GitHub
53
64
54
- First,
55
- [ register a GitHub OAuth app ] ( https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/ ) .
56
- GitHub will ask you for the following Coder parameters:
65
+ 1 . [ Register a GitHub OAuth app ] ( https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/ ) .
66
+
67
+ 1 . GitHub will ask you for the following Coder parameters:
57
68
58
- - ** Homepage URL** : Set to your Coder deployments
59
- [ ` CODER_ACCESS_URL ` ] ( ../../reference/cli/server.md#--access-url ) (e.g.
60
- ` https://coder.domain.com ` )
61
- - ** User Authorization Callback URL** : Set to ` https://coder.domain.com `
69
+ - ** Homepage URL** : Set to your Coder deployment's
70
+ [ ` CODER_ACCESS_URL ` ] ( ../../reference/cli/server.md#--access-url ) (e.g.
71
+ ` https://coder.domain.com ` )
72
+ - ** User Authorization Callback URL** : Set to ` https://coder.domain.com `
62
73
63
- If you want to allow multiple Coder deployments hosted on subdomains, such as
64
- ` coder1.domain.com ` , ` coder2.domain.com ` , to authenticate with the
65
- same GitHub OAuth app, then you can set ** User Authorization Callback URL** to
66
- the ` https://domain.com `
74
+ If you want to allow multiple Coder deployments hosted on subdomains, such as
75
+ ` coder1.domain.com ` , ` coder2.domain.com ` , to authenticate with the
76
+ same GitHub OAuth app, then you can set ** User Authorization Callback URL** to
77
+ the ` https://domain.com `
67
78
68
- Take note of the Client ID and Client Secret generated by GitHub. You will use these
69
- values in the next step.
79
+ 1 . Take note of the Client ID and Client Secret generated by GitHub.
80
+ You will use these values in the next step.
70
81
71
- Coder will need permission to access user email addresses. Find the "Account
72
- Permissions" settings for your app and select "read-only" for "Email addresses".
82
+ 1 . Coder needs permission to access user email addresses.
83
+
84
+ Find the ** Account Permissions** settings for your app and select ** read-only** for ** Email addresses** .
73
85
74
86
## Step 2: Configure Coder with the OAuth credentials
75
87
76
- Navigate to your Coder host and run the following command to start up the Coder
77
- server:
88
+ Go to your Coder host and run the following command to start up the Coder server:
78
89
79
90
``` shell
80
91
coder server --oauth2-github-allow-signups=true --oauth2-github-allowed-orgs=" your-org" --oauth2-github-client-id=" 8d1...e05" --oauth2-github-client-secret=" 57ebc9...02c24c"
@@ -87,7 +98,7 @@ Alternatively, if you are running Coder as a system service, you can achieve the
87
98
same result as the command above by adding the following environment variables
88
99
to the ` /etc/coder.d/coder.env ` file:
89
100
90
- ``` env
101
+ ``` shell
91
102
CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS=true
92
103
CODER_OAUTH2_GITHUB_ALLOWED_ORGS=" your-org"
93
104
CODER_OAUTH2_GITHUB_CLIENT_ID=" 8d1...e05"
@@ -97,7 +108,7 @@ CODER_OAUTH2_GITHUB_CLIENT_SECRET="57ebc9...02c24c"
97
108
> [ !TIP]
98
109
> To allow everyone to sign up using GitHub, set:
99
110
>
100
- > ``` env
111
+ > ``` shell
101
112
> CODER_OAUTH2_GITHUB_ALLOW_EVERYONE=true
102
113
> ` ` `
103
114
@@ -129,23 +140,24 @@ To upgrade Coder, run:
129
140
helm upgrade < release-name> coder-v2/coder -n < namespace> -f values.yaml
130
141
```
131
142
132
- We recommend requiring and auditing MFA usage for all users in your GitHub
133
- organizations. This can be enforced from the organization settings page in the
134
- "Authentication security" sidebar tab.
143
+ We recommend requiring and auditing MFA usage for all users in your GitHub organizations.
144
+ This can be enforced from the organization settings page in the ** Authentication security** sidebar tab.
135
145
136
146
## Device Flow
137
147
138
148
Coder supports
139
149
[ device flow] ( https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#device-flow )
140
- for GitHub OAuth. This is enabled by default for the default GitHub app and cannot be disabled
141
- for that app. For your own custom GitHub OAuth app, you can enable device flow by setting:
150
+ for GitHub OAuth.
151
+ This is enabled by default for the default GitHub app and cannot be disabled for that app.
142
152
143
- ``` env
153
+ For your own custom GitHub OAuth app, you can enable device flow by setting:
154
+
155
+ ``` shell
144
156
CODER_OAUTH2_GITHUB_DEVICE_FLOW=true
145
157
```
146
158
147
- Device flow is optional for custom GitHub OAuth apps. We generally recommend using
148
- the standard OAuth flow instead, as it is more convenient for end users.
159
+ Device flow is optional for custom GitHub OAuth apps.
160
+ We generally recommend using the standard OAuth flow instead, as it is more convenient for end users.
149
161
150
162
> [ !NOTE]
151
163
> If you're using the default GitHub app, device flow is always enabled regardless of
0 commit comments