Hi, there seems to be an issue with the authorisation of access tokens using the API. Regardless of username/password combination, basic authorisation headers, or URL based tokens all from admins and not, the post and get commands return a 401.

Am i missing something? and has anyone had this working?


If none is working, then either you put wrong credentials, or you’re connecting to the wrong Gogs instance. Or… if you don’t delete post template so quickly… I can offer more help.


Hi Unknwon, thanks for getting back. What do you mean by don’t delete post template? I can 100% confirm that i’m using the right gogs instance (only have 1 running) and i have confirmed the username/password details over and over. All other API calls are working fine.


The template is the default text in your box before you type anything for a new post.


sorry, i must be missing something. I’m calling this both with a browsers and postman so there is no default text. but i guess you mean the post JSON e.g.
“name”: “gogs”

i’m just call the URL direct like: https://myurl/api/v1/users/mynewuser/tokens?token=36336c37666cd5dc35f822ce54a0a6b1e1e1b710



ah sorry, my bad

Can reproduce on @

application token is create under user settings: name = test (is currently denoted as active, used in last 7 days)

my info:
Gogs Version:
Mysql data store
runing gogs/gogs docker instance


You can not get/create access token with access tokens, this is prohibited by design. You must use basic authentication for this particular API end point.


Hi, so i’ve got it working. If you use a direct cURL command or call it through code it works e.g.


curl -X GET
-H ‘authorization: Basic YWhlbmRyeToxMjM0NTY3’
-H ‘cache-control: no-cache’
-H ‘content-type: application/json’
-H ‘postman-token: 0b37aa53-c01e-ea27-a1a4-26a1f17a98bf’

Using postman or browser fails (browser i can understand but not sure what is going on with postman as it works for everything else)

Cheers for the support