@@ -19,7 +19,7 @@ class AuthorizationCodeRequest(BaseModel):
1919 grant_type : Literal ["authorization_code" ]
2020 code : str = Field (..., description = "The authorization code" )
2121 redirect_uri : AnyUrl | None = Field (None , description = "Must be the same as redirect URI provided in /authorize" )
22- client_id : str
22+ client_id : str | None = Field ( None , description = "If none, client_id must be provided via basic auth header" )
2323 # we use the client_secret param, per https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1
2424 client_secret : str | None = None
2525 # See https://datatracker.ietf.org/doc/html/rfc7636#section-4.5
@@ -131,7 +131,7 @@ async def handle(self, request: Request):
131131 match token_request :
132132 case AuthorizationCodeRequest ():
133133 auth_code = await self .provider .load_authorization_code (client_info , token_request .code )
134- if auth_code is None or auth_code .client_id != token_request .client_id :
134+ if auth_code is None or auth_code .client_id != client_info .client_id :
135135 # if code belongs to different client, pretend it doesn't exist
136136 return self .response (
137137 TokenErrorResponse (
@@ -197,7 +197,7 @@ async def handle(self, request: Request):
197197
198198 case RefreshTokenRequest (): # pragma: no cover
199199 refresh_token = await self .provider .load_refresh_token (client_info , token_request .refresh_token )
200- if refresh_token is None or refresh_token .client_id != token_request .client_id :
200+ if refresh_token is None or refresh_token .client_id != client_info .client_id :
201201 # if token belongs to different client, pretend it doesn't exist
202202 return self .response (
203203 TokenErrorResponse (
0 commit comments