Gitea: Accessing the API with http header "Authorization" does not work

Created on 15 Mar 2018  路  1Comment  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.3.2
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04
  • Database (use [x]):

    • [ ] PostgreSQL

    • [x] MySQL

    • [ ] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [x] No (try.gitea.io is down)

    • [ ] Not relevant

  • Log gist:

Description

Accessing the API with http header "Authorization" does not work.

curl \
  --resolve gitea.net:3000:10.0.0.112 \
  -X GET \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  'http://gitea.net:3000/api/v1/repos/devs/tmv4/keys?token=4a40ddb4190802e39825f06ec8a04a4ba3af22bf'; echo
[]

The same for access_token=.
Using Authorization header:

curl \
  --resolve gitea.net:3000:10.0.0.112 \
  -X GET \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: 4a40ddb4190802e39825f06ec8a04a4ba3af22bf' \
  http://gitea.net:3000/api/v1/repos/devs/tmv4/keys; echo
{"message":"Only signed in user is allowed to call APIs."}

No helpfull information in Debug and Trace logs. (?)

Most helpful comment

Reviewing the code revealed that providing -H 'Authorization: token 4a40ddb4190802e39825f06ec8a04a4ba3af22bf seems to work. This would be something which really required some documentation, I guess.

>All comments

Reviewing the code revealed that providing -H 'Authorization: token 4a40ddb4190802e39825f06ec8a04a4ba3af22bf seems to work. This would be something which really required some documentation, I guess.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kifirkin picture kifirkin  路  3Comments

cookiengineer picture cookiengineer  路  3Comments

jonasfranz picture jonasfranz  路  3Comments

kolargol picture kolargol  路  3Comments

adpande picture adpande  路  3Comments