Update for httpx-oauth >= 0.10 where account_email can be None

This commit is contained in:
François Voron
2022-11-04 09:35:51 +01:00
parent 08860167d1
commit c91e7657db
4 changed files with 69 additions and 1 deletions

View File

@ -111,6 +111,12 @@ def get_oauth_router(
token["access_token"]
)
if account_email is None:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ErrorCode.OAUTH_NOT_AVAILABLE_EMAIL,
)
try:
decode_jwt(state, state_secret, [STATE_TOKEN_AUDIENCE])
except jwt.DecodeError:
@ -235,6 +241,12 @@ def get_oauth_associate_router(
token["access_token"]
)
if account_email is None:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail=ErrorCode.OAUTH_NOT_AVAILABLE_EMAIL,
)
try:
state_data = decode_jwt(state, state_secret, [STATE_TOKEN_AUDIENCE])
except jwt.DecodeError: