Skip to content

Allow fetching current auth token via CLI #21515

@matifali

Description

@matifali

Problem

gh CLI has a nice command to get the current auth token via gh auth token, which can be useful for automation or scripts to retrieve the token on demand instead of preseeding the environment before the script starts.

Suggestion

Add a similar coder login token command to retrieve the currently used token for use in scripts. It can then be used as.

CODER_SESSION_TOKEN=$(coder login token)

# OR when using AI Bridge
ANTHROPIC_API_TOKEN=$(coder login token)
ANTHROPIC_BASE_URL="$(coder login url)/api/v2/aibridge/anthropic" # Additionally same can be done for acess url.
claude

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions