mirror of
https://codeberg.org/forgejo/docs.git
synced 2024-11-22 17:48:39 -05:00
docs: api-usage: tokens need 'scopes'
Document the "scopes" field that is now required when generating API tokens. Refer to the documentation of scope names.
Signed-off-by: julianfoad <julian@foad.me.uk>
(cherry picked from commit 953989cd7e
)
This commit is contained in:
parent
55a5065b7a
commit
16969d65fd
1 changed files with 4 additions and 2 deletions
|
@ -33,10 +33,12 @@ Note that `/users/:name/tokens` is a special endpoint and requires you
|
||||||
to authenticate using `BasicAuth` and a password, as follows:
|
to authenticate using `BasicAuth` and a password, as follows:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ curl -H "Content-Type: application/json" -d '{"name":"test"}' -u username:password https://forgejo.your.host/api/v1/users/<username>/tokens
|
$ curl -H "Content-Type: application/json" -d '{"name":"test","scopes":["write:package"]}' -u username:password https://forgejo.your.host/api/v1/users/<username>/tokens
|
||||||
{"id":1,"name":"test","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
|
{"id":1,"name":"test","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d","scopes":["write:package"]}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The keys of the JSON data object are `name` (the display name for the token) and `scopes` (list of [Access Token scope](../token-scope/) names).
|
||||||
|
|
||||||
The `sha1` (the token) is only returned once and is not stored in
|
The `sha1` (the token) is only returned once and is not stored in
|
||||||
plain-text. It will not be displayed when listing tokens with a `GET`
|
plain-text. It will not be displayed when listing tokens with a `GET`
|
||||||
request; e.g.
|
request; e.g.
|
||||||
|
|
Loading…
Reference in a new issue