Skip to content

Incomplete API POST reponse for scopes in /api/v1/users/<user>/tokens #32078

@FrostKiwi

Description

@FrostKiwi

Description

When creating a token via the API and supplying scopes, eg...

curl -k -H "Content-Type: application/json" -d '{"name":"test2", "scopes":["write:package", "read:notification"]}' -u user:pass https://gitea.domain.com/api/v1/users/Vlad/tokens

the response for scopes is always null, eg.

{"id":13,"name":"test2","sha1":"6xxxxxxxxxxxxxx87c","token_last_eight":"bd4e087c","scopes":null}

even though the permissions are actually there:

curl -k -H "Content-Type: application/json" -u user:pass https://gitea.domain.com/api/v1/users/Vlad/tokens
[{"id":13,"name":"test2","sha1":"","token_last_eight":"bd4e087c","scopes":["read:notification","write:package"]}]

This issue was found when updating the documentation in pull request https://gitea.com/gitea/docs/pulls/72

Gitea Version

1.22.2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Ubuntu server, installed via binaries downloaded from this repo

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions