IndominusByte / fastapi-jwt-auth

FastAPI extension that provides JWT Auth support (secure, easy to use, and lightweight)
http://indominusbyte.github.io/fastapi-jwt-auth/
MIT License
644 stars 150 forks source link

500 error if token invalid instead of 422 #56

Open giuseppecalderaro opened 3 years ago

giuseppecalderaro commented 3 years ago

I am seeing a 500 error when passing a wrong token instead of the usual 422. This happens with every version above 0.2.0.

Very basic example:

@auth_api_router_v1_0.get('/verify', status_code=status.HTTP_200_OK)
async def verify(authorize: AuthJWT = Depends()):
    authorize.jwt_required()
    return {'valid': True}

this is with a valid token, all good image

and this if token is expired: image