Skip to content

docs: add mention of CLI command to create token on behalf of another user #15138

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

Merged
merged 4 commits into from
Feb 14, 2025
Merged
Changes from 2 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
22 changes: 20 additions & 2 deletions docs/admin/users/sessions-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,29 @@ See the help docs for

### Generate a long-lived API token on behalf of another user

Today, you must use the REST API to generate a token on behalf of another user.
You must have the `Owner` role to do this. Use our API reference for more
<div class="tabs">

## CLI

As of Coder v2.17+, you can create long-lived tokens on behalf of other users if
your account is `Owner`. Use the following command:

```sh
coder tokens create my-token --user <username>
```

See the full API reference for
[`coder tokens create`](../../reference/cli/tokens_create.md)

## API

You can also use the REST API to generate a token on behalf of another user. You
must have the `Owner` role to do this. Use our API reference for more
information:
[Create token API key](https://coder.com/docs/reference/api/users#create-token-api-key)

</div>

### Set max token length

You can use the
Expand Down
Loading