Skip to content

Accessing the API with http header "Authorization" does not work #3673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 7 tasks
ghost opened this issue Mar 15, 2018 · 1 comment
Closed
2 of 7 tasks

Accessing the API with http header "Authorization" does not work #3673

ghost opened this issue Mar 15, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 15, 2018

  • Gitea version (or commit ref): 1.3.2
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • 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. (?)

@ghost
Copy link
Author

ghost commented Mar 15, 2018

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

@ghost ghost closed this as completed Mar 15, 2018
stevegt added a commit to stevegt/gitea that referenced this issue Jun 24, 2018
* Build on work by @tungsheng

* Address issues raised in go-gitea#4037, go-gitea#3673, and go-gitea#4243

* Close go-gitea#4247

Signed-off-by: Steve Traugott <[email protected]>
lunny pushed a commit that referenced this issue Jun 25, 2018
* add api user guides in doc

* update user-guides api page

* fix typo: user guides -> user guide

* move api-usage page under advanced category

* flesh out API usage docs

* Build on work by @tungsheng

* Address issues raised in #4037, #3673, and #4243

* Close #4247

Signed-off-by: Steve Traugott <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants