Login user via api and get token


#1

I am trying to use gitea as a backend system, and as such want to login with username and password via the api and then use a token for any further api requests

I must be blind - I just can’t see any documented api for login. I see that there is a “basic” auth but I don’t want to use that in case the headers get logged.

The login POST’s to /user/login - I have tried that, but no token is returned

any insight would be appreciated :wink:


#2

Here is the documentation on creating a token: https://try.gitea.io/api/swagger#/user/userCreateToken you must use username/pass via basic auth on that endpoint. Once you have a token you can use it an all other endpoints.