From 3f023b3b62e274301369fe22430e56be2d4a8fb6 Mon Sep 17 00:00:00 2001 From: wethinkagile Date: Fri, 7 Mar 2025 03:28:59 +0000 Subject: [PATCH] fix/get-tokens-example (#179) Users reported issues at https://github.com/go-gitea/gitea/issues/28820 Co-authored-by: Stephan Kristyn Co-authored-by: techknowlogick Reviewed-on: https://gitea.com/gitea/docs/pulls/179 Reviewed-by: Lunny Xiao Reviewed-by: techknowlogick Co-authored-by: wethinkagile Co-committed-by: wethinkagile --- docs/development/api-usage.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/development/api-usage.md b/docs/development/api-usage.md index 48c82380..18dd3938 100644 --- a/docs/development/api-usage.md +++ b/docs/development/api-usage.md @@ -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//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