Backend: Change status code of token invalid error
This commit is contained in:
parent
be736638bd
commit
148275dd98
1 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ class JWTBearer(HTTPBearer):
|
||||||
if credentials:
|
if credentials:
|
||||||
if not credentials.scheme == "Bearer":
|
if not credentials.scheme == "Bearer":
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=403, detail="authentication_scheme_invalid"
|
status_code=401, detail="authentication_scheme_invalid"
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
token = await token_service.verify_access_token(
|
token = await token_service.verify_access_token(
|
||||||
|
@ -36,7 +36,7 @@ class JWTBearer(HTTPBearer):
|
||||||
)
|
)
|
||||||
if not token:
|
if not token:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=403, detail="token_invalid_or_expired"
|
status_code=401, detail="token_invalid_or_expired"
|
||||||
)
|
)
|
||||||
return token
|
return token
|
||||||
except InsufficientPermissionsError:
|
except InsufficientPermissionsError:
|
||||||
|
@ -44,4 +44,4 @@ class JWTBearer(HTTPBearer):
|
||||||
except InvalidTokenAudienceError:
|
except InvalidTokenAudienceError:
|
||||||
raise HTTPException(status_code=403, detail="invalid_token_audience")
|
raise HTTPException(status_code=403, detail="invalid_token_audience")
|
||||||
else:
|
else:
|
||||||
raise HTTPException(status_code=403, detail="authorization_code_invalid")
|
raise HTTPException(status_code=401, detail="authorization_code_invalid")
|
Loading…
Add table
Reference in a new issue