fix/get-tokens-example (#179)

Users reported issues at https://github.com/go-gitea/gitea/issues/28820

Co-authored-by: Stephan Kristyn <account@stevek.pro>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/docs/pulls/179
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: wethinkagile <wethinkagile@noreply.gitea.com>
Co-committed-by: wethinkagile <wethinkagile@noreply.gitea.com>
This commit is contained in:
wethinkagile
2025-03-07 03:28:59 +00:00
committed by techknowlogick
parent 8c7577a67c
commit 3f023b3b62

View File

@@ -35,8 +35,9 @@ Note that `/users/:name/tokens` is a special endpoint and requires you
to authenticate using `BasicAuth` and a password, as follows:
```sh
$ curl -H "Content-Type: application/json" -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
{"id":1,"name":"test","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
$ curl -H "Content-Type: application/json" -d '{"name":test_token","scopes":["read|write:activitypub|issue|misc|notification|organization|package|repository|user"]}'
-u 'username:password' "https://gitea.your.host/api/v1/users/{username}/tokens"
{"id":1,"name":"test_token","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
```
The ``sha1`` (the token) is only returned once and is not stored in