OAuth2 access token call /login/oauth/access_token always returns unsupported_grant_type #5680

Closed
opened 2025-11-02 06:32:55 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @shaikhshahidg on GitHub (Jul 3, 2020).

  • Gitea version (or commit ref): gitea-master-linux-amd64
  • Git version:NA
  • Operating system: Cent OS
  • Database (use [x]):
    • PostgreSQL
    • [ x] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [x ] Not relevant
  • Log gist:

Description

I have been trying accessing to obtain access token for Gitea , I have invoked "/login/oauth/access_token" as post API with
request body as below
{
"grant_type": "authorization_code",
"code": "",
"redirect_uri": "http://localhost:8080/js/qa/oauth2.jsp",
"client_id": "",
"client_secret",""
}

Possible options tried for grant_type is "authorization_code" & "refresh_token" with valid details for code , client_id & client_secret.

for all invocations i get

"
{
"error": "unsupported_grant_type",
"error_description": "Only refresh_token or authorization_code grant type is supported"
}

"
...

Screenshots

image
image

Originally created by @shaikhshahidg on GitHub (Jul 3, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): gitea-master-linux-amd64 - Git version:NA - Operating system: Cent OS - Database (use `[x]`): - [ ] PostgreSQL - [ x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x ] Not relevant - Log gist: ## Description I have been trying accessing to obtain access token for Gitea , I have invoked "**/login/oauth/access_token**" as post API with request body as below { "grant_type": "authorization_code", "code": "", "redirect_uri": "http://localhost:8080/js/qa/oauth2.jsp", "client_id": "", "client_secret","" } Possible options tried for grant_type is "**authorization_code**" & "**refresh_token**" with valid details for code , client_id & client_secret. for all invocations i get " **_{ "error": "unsupported_grant_type", "error_description": "Only refresh_token or authorization_code grant type is supported" }_** " ... ## Screenshots ![image](https://user-images.githubusercontent.com/3368971/86429723-020fc080-bd0e-11ea-9c06-10b3caf903b3.png) ![image](https://user-images.githubusercontent.com/3368971/86429981-b6a9e200-bd0e-11ea-970b-b5fae1b8659b.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the issue/stale label 2025-11-02 06:32:55 -06:00
Author
Owner

@stale[bot] commented on GitHub (Sep 1, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Sep 1, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (Sep 2, 2020):

Please take https://gitea.com/lunny/testGiteaOauth2 as an example.

@lunny commented on GitHub (Sep 2, 2020): Please take https://gitea.com/lunny/testGiteaOauth2 as an example.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5680