Skip to content

🐛 Bug Report - query param client_secret is missing even though client_secret is registered in the OAuth2Config #37

@kkh-147-17-3

Description

@kkh-147-17-3

Bug description

Hi, I was trying to integrate KakaoOAuth2 and had to apply client_secret for the authentication. The provider(Kakao) says the client_secret for KakaoOauth2 is not mandatory but is recommended for the security purpose. Therefore, I set my application to use that.
Unfortunately, KakaoOauth2 does not work only when the client_secret is configured.

According to the official Kakao developer website, the client_secret must be in the request body as query parameter when the application is configured to utilize client_secret. Otherwise, it returns unauthorization response.

I looked through the codes and found out that the client_secret is not in the query parameters when POST requesting the token end point.

Reproduction URL

No response

Reproduction steps

  1. Add application at the Kakao Developer Website and configure the application to use client_secret as below
    Screenshot 2024-03-13 at 3 50 31 PM

  2. Add configuration in the fastapi code.
    Screenshot 2024-03-13 at 3 53 21 PM

  3. Send the request /oauth2/kakao/authorize

  4. After step 3, I receieved the following error

{"detail":"(invalid_client) Bad client credentials"}

Screenshots

The original codes are as follows (fastapi_oauth2.core.py -> OAuth2Core:token_data):

Screenshot 2024-03-13 at 3 38 37 PM

I guess the client_secretshould be in the oauth2_query_params so that the variable content can contain client_secret as a query parameter.

After I changed the code to put client_secret inside the query params, the authentication process worked as normal.
Screenshot 2024-03-13 at 3 35 51 PM

Logs

No response

Browsers

No response

OS

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions