Skip to content

Commit 2db695b

Browse files
docs: update external auth to better explain process (#15970)
Reference #15968 Adds more information on how to add external auth, including docker-compose and docker CLI examples and terraform code for template integration. --------- Co-authored-by: Muhammad Atif Ali <me@matifali.dev>
1 parent 761a196 commit 2db695b

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

docs/admin/external-auth.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,47 @@ application. The following providers are supported:
1212
The next step is to configure the Coder server to use the OAuth application by
1313
setting the following environment variables:
1414

15+
## Configuration
16+
1517
```env
1618
CODER_EXTERNAL_AUTH_0_ID="<USER_DEFINED_ID>"
1719
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
20+
CODER_EXTERNAL_AUTH_0_CLIENT_ID=<OAuth app client ID>
21+
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=<OAuth app client secret>
2022
2123
# Optionally, configure a custom display name and icon
2224
CODER_EXTERNAL_AUTH_0_DISPLAY_NAME="Google Calendar"
2325
CODER_EXTERNAL_AUTH_0_DISPLAY_ICON="https://mycustomicon.com/google.svg"
2426
```
25-
2627
The `CODER_EXTERNAL_AUTH_0_ID` environment variable is used for internal
2728
reference. Therefore, it can be set arbitrarily (e.g., `primary-github` for your
2829
GitHub provider).
2930

31+
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.
32+
33+
```tf
34+
data "coder_external_auth" "<github|gitlab|azure-devops|bitbucket-cloud|bitbucket-server|etc>" {
35+
id = "<USER_DEFINED_ID>"
36+
}
37+
38+
# Github Example (CODER_EXTERNAL_AUTH_0_ID="github-auth")
39+
# makes a github authentication token available at data.coder_external_auth.github.access_token
40+
data "coder_external_auth" "github" {
41+
id = "github-auth"
42+
}
43+
44+
```
45+
46+
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.
47+
48+
### Workspace CLI
49+
An access token can be accessed within the workspace by using
50+
51+
```
52+
coder external-auth <USER_DEFINED_ID> access-token
53+
```
54+
55+
3056
## GitHub
3157

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

0 commit comments

Comments
 (0)