Files
coder/docs/reference/cli/external-auth_access-token.md
T
Spike Curtis 1354d84eb4 chore: refactor instance identity to be a SessionTokenProvider (#19566)
Refactors Agent instance identity to be a SessionTokenProvider.

Refactors the CLI to create Agent clients via a centralized function, rather than add-hoc via individual command handlers and their flags.

This allows commands besides `coder agent`, but which still use the agent identity, to support instance identity authentication.

Fixes #19111 by unifying all API requests to go thru the SessionTokenProvider for auth credentials.
2025-09-03 10:38:42 +04:00

80 lines
2.1 KiB
Markdown
Generated

<!-- DO NOT EDIT | GENERATED CONTENT -->
# external-auth access-token
Print auth for an external provider
## Usage
```console
coder external-auth access-token [flags] <provider>
```
## Description
```console
Print an access-token for an external auth provider. The access-token will be validated and sent to stdout with exit code 0. If a valid access-token cannot be obtained, the URL to authenticate will be sent to stdout with exit code 1
- Ensure that the user is authenticated with GitHub before cloning.:
$ #!/usr/bin/env sh
OUTPUT=$(coder external-auth access-token github)
if [ $? -eq 0 ]; then
echo "Authenticated with GitHub"
else
echo "Please authenticate with GitHub:"
echo $OUTPUT
fi
- Obtain an extra property of an access token for additional metadata.:
$ coder external-auth access-token slack --extra "authed_user.id"
```
## Options
### --extra
| | |
|------|---------------------|
| Type | <code>string</code> |
Extract a field from the "extra" properties of the OAuth token.
### --agent-token
| | |
|-------------|---------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_AGENT_TOKEN</code> |
An agent authentication token.
### --agent-token-file
| | |
|-------------|--------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_AGENT_TOKEN_FILE</code> |
A file containing an agent authentication token.
### --agent-url
| | |
|-------------|-------------------------------|
| Type | <code>url</code> |
| Environment | <code>$CODER_AGENT_URL</code> |
URL for an agent to access your deployment.
### --auth
| | |
|-------------|--------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_AGENT_AUTH</code> |
| Default | <code>token</code> |
Specify the authentication type to use for the agent.