Skip to content

Commit

Permalink
WIP: fix oidc/oauth2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaupetit committed May 28, 2024
1 parent f30bcd5 commit 16b9ec1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/api/qualicharge/auth/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import httpx
from fastapi import Depends
from fastapi.security import (
HTTPAuthorizationCredentials,
HTTPBearer,
OAuth2PasswordBearer,
SecurityScopes,
Expand Down Expand Up @@ -81,8 +82,7 @@ def get_public_keys(

def get_token(
security_scopes: SecurityScopes,
# token: Annotated[HTTPAuthorizationCredentials, Depends(auth_scheme)],
token: Annotated[str, Depends(auth_scheme)],
token: Annotated[Union[HTTPAuthorizationCredentials, str], Depends(auth_scheme)],
) -> IDToken:
"""Decode and validate OpenId Connect ID token given a configured provider.
Expand Down Expand Up @@ -123,8 +123,7 @@ def get_token(

try:
decoded_token = jwt.decode(
# token=token.credentials,
token=token,
token=token.credentials if settings.OIDC_IS_ENABLED else token,
key=key,
algorithms=algorithms,
**extra_decode_options, # type: ignore[arg-type]
Expand Down

0 comments on commit 16b9ec1

Please sign in to comment.