Skip to content

Commit b29859a

Browse files
[docs] update external auth to better explain process
1 parent 8befb34 commit b29859a

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

docs/admin/external-auth.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,72 @@ application. The following providers are supported:
1111

1212
The next step is to configure the Coder server to use the OAuth application by
1313
setting the following environment variables:
14+
<div class="tabs">
15+
16+
## Environment Variables
1417

1518
```env
1619
CODER_EXTERNAL_AUTH_0_ID="<USER_DEFINED_ID>"
1720
CODER_EXTERNAL_AUTH_0_TYPE=<github|gitlab|azure-devops|bitbucket-cloud|bitbucket-server|etc>
18-
CODER_EXTERNAL_AUTH_0_CLIENT_ID=xxxxxx
19-
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=xxxxxxx
21+
CODER_EXTERNAL_AUTH_0_CLIENT_ID=<OAuth app client ID>
22+
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=<OAuth app client secret>
2023
2124
# Optionally, configure a custom display name and icon
2225
CODER_EXTERNAL_AUTH_0_DISPLAY_NAME="Google Calendar"
2326
CODER_EXTERNAL_AUTH_0_DISPLAY_ICON="https://mycustomicon.com/google.svg"
2427
```
28+
The `CODER_EXTERNAL_AUTH_0_ID` environment variable is used for internal
29+
reference. Therefore, it can be set arbitrarily (e.g., `primary-github` for your
30+
GitHub provider).
31+
32+
## Docker Compose
33+
34+
```yaml
35+
services:
36+
coder:
37+
environment:
38+
CODER_EXTERNAL_AUTH_0_ID: <USER_DEFINED_ID>
39+
CODER_EXTERNAL_AUTH_0_TYPE: <github|gitlab|azure-devops|bitbucket-cloud|bitbucket-server|etc>
40+
CODER_EXTERNAL_AUTH_0_CLIENT_ID: <OAuth app client ID>
41+
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET: <OAuth app client secret>
42+
```
43+
44+
The `CODER_EXTERNAL_AUTH_0_ID` environment variable is used for internal
45+
reference. Therefore, it can be set arbitrarily (e.g., `primary-github` for your
46+
GitHub provider).
47+
48+
## Docker CLI
49+
50+
```sh
51+
export DOCKER_GROUP=$(getent group docker | cut -d: -f3)
52+
docker run --rm -it \
53+
-e CODER_ACCESS_URL="https://coder.example.com" \
54+
-e CODER_PG_CONECTION_URL="postgresql://username:password@database/coder" \
55+
-e CODER_EXTERNAL_AUTH_0_ID="<USER_DEFINED_ID>" \
56+
-e CODER_EXTERNAL_AUTH_0_TYPE="<github|gitlab|azure-devops|bitbucket-cloud|bitbucket-server|etc>" \
57+
-e CODER_EXTERNAL_AUTH_0_CLIENT_ID="<OAuth app client ID>" \
58+
-e CODER_EXTERNAL_AUTH_0_CLIENT_SECRET="<OAuth app client secret>" \
59+
-v /var/run/docker.sock:/var/run/docker.sock \
60+
--group-add $DOCKER_GROUP \
61+
ghcr.io/coder/coder:latest
62+
```
2563

2664
The `CODER_EXTERNAL_AUTH_0_ID` environment variable is used for internal
2765
reference. Therefore, it can be set arbitrarily (e.g., `primary-github` for your
2866
GitHub provider).
2967

68+
</div>
69+
70+
You can now add the following code to any template. This will add a button to the workspace setup page which will allow you to authenticate with your provider.
71+
72+
```tf
73+
data "coder_external_auth" "<github|gitlab|azure-devops|bitbucket-cloud|bitbucket-server|etc>" {
74+
id = "<USER_DEFINED_ID>"
75+
}
76+
```
77+
78+
Inside your terraform code, you now have access to authentication variables. Reference the documentation for your chosen provider for more information on how to supply it with a token.
79+
3080
## GitHub
3181

3282
> If you don't require fine-grained access control, it's easier to configure a

0 commit comments

Comments
 (0)