Skip to content

docs(cli): add usage examples for argo auth token command Fixes #11898 #14655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/argo/commands/auth/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ func NewTokenCommand() *cobra.Command {
return &cobra.Command{
Use: "token",
Short: "Print the auth token",
Args: cobra.NoArgs,
Example: `
# Print the auth token for the current Argo Server
argo auth token

# Save the token to a variable and send a request directly to the Argo API
TOKEN=$(argo auth token) && curl -H "Authorization: Bearer $TOKEN" https://<ARGO_SERVER>/api/v1/userinfo
`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
authString, err := client.GetAuthString()
if err != nil {
Expand Down
12 changes: 12 additions & 0 deletions docs/cli/argo_auth_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ Print the auth token
argo auth token [flags]
```

### Examples

```

# Print the auth token for the current Argo Server
argo auth token

# Save the token to a variable and send a request directly to the Argo API
TOKEN=$(argo auth token) && curl -H "Authorization: Bearer $TOKEN" https://<ARGO_SERVER>/api/v1/userinfo

```

### Options

```
Expand Down
Loading