Skip to content

Commit 9461b64

Browse files
committed
set a better example
1 parent 429ee1d commit 9461b64

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/admin/external-auth.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ CODER_EXTERNAL_AUTH_0_DISPLAY_ICON="https://mycustomicon.com/google.svg"
3636
```
3737

3838
The `CODER_EXTERNAL_AUTH_0_ID` environment variable is used as an identifier for the authentication provider.
39+
3940
This variable is used as part of the callback URL path that you must configure in your OAuth provider settings.
41+
If the value in your callback URL doesn't match the `CODER_EXTERNAL_AUTH_0_ID` value, authentication will fail with `redirect URI is not valid`.
4042
Set it with a value that helps you identify the provider.
4143
For example, if you use `CODER_EXTERNAL_AUTH_0_ID="primary-github"` for your GitHub provider,
42-
your callback URL will be `https://example.com/external-auth/primary-github/callback`.
44+
configure your callback URL as `https://example.com/external-auth/primary-github/callback`.
4345

4446
### Add an authentication button to the workspace template
4547

@@ -66,7 +68,7 @@ Reference the documentation for your chosen provider for more information on how
6668
Use [`external-auth`](../reference/cli/external-auth.md) in the Coder CLI to access a token within the workspace:
6769

6870
```shell
69-
coder external-auth <USER_DEFINED_ID> access-token
71+
coder external-auth access-token <USER_DEFINED_ID>
7072
```
7173

7274
## Git-provider specific env variables
@@ -139,16 +141,16 @@ For a more complete, step-by-step guide, follow the
139141
[configure a GitHub OAuth app](#configure-a-github-oauth-app) section instead.
140142

141143
```env
142-
CODER_EXTERNAL_AUTH_0_ID="USER_DEFINED_ID"
144+
CODER_EXTERNAL_AUTH_0_ID="primary-github"
143145
CODER_EXTERNAL_AUTH_0_TYPE=github
144146
CODER_EXTERNAL_AUTH_0_CLIENT_ID=xxxxxx
145147
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=xxxxxxx
146148
```
147149

148150
When configuring your GitHub OAuth application, set the
149151
[authorization callback URL](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/about-the-user-authorization-callback-url)
150-
as `https://example.com/external-auth/USER_DEFINED_ID/callback`, where
151-
`USER_DEFINED_ID` matches your `CODER_EXTERNAL_AUTH_0_ID` value (in this example, `USER_DEFINED_ID`).
152+
as `https://example.com/external-auth/primary-github/callback`, where
153+
`primary-github` matches your `CODER_EXTERNAL_AUTH_0_ID` value.
152154

153155
### GitHub Enterprise
154156

@@ -167,7 +169,7 @@ CODER_EXTERNAL_AUTH_0_TOKEN_URL="https://github.example.com/login/oauth/access_t
167169
When configuring your GitHub Enterprise OAuth application, set the
168170
[authorization callback URL](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/about-the-user-authorization-callback-url)
169171
as `https://example.com/external-auth/primary-github/callback`, where
170-
`USER_DEFINED_ID` matches your `CODER_EXTERNAL_AUTH_0_ID` value (in this example, `primary-github`).
172+
`primary-github` matches your `CODER_EXTERNAL_AUTH_0_ID` value.
171173

172174
### GitLab self-managed
173175

@@ -223,7 +225,7 @@ CODER_EXTERNAL_AUTH_0_SCOPES="repo:read repo:write write:gpg_key"
223225
1. [Create a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app)
224226

225227
- Set the authorization callback URL to
226-
`https://coder.example.com/external-auth/USER_DEFINED_ID/callback`, where `USER_DEFINED_ID`
228+
`https://coder.example.com/external-auth/primary-github/callback`, where `primary-github`
227229
is the value you set for `CODER_EXTERNAL_AUTH_0_ID`.
228230
- Deactivate Webhooks.
229231
- Enable fine-grained access to specific repositories or a subset of

0 commit comments

Comments
 (0)