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
630 stars 143 forks source link

Error dosen't return to response with FastAPI #35

Closed mrwan200 closed 3 years ago

mrwan200 commented 3 years ago

Hello I have tried to refresh token and test if send authorization is not real token but FastAPI respone to 500 Internet Server Error. Why not response with custom error FastAPI JWT Auth?

Sorry my English so bad. :(

Here my error image

IndominusByte commented 3 years ago

did you already have an exception handler on your fastAPI?

@app.exception_handler(AuthJWTException)
def authjwt_exception_handler(request: Request, exc: AuthJWTException):
    return JSONResponse(
        status_code=exc.status_code,
        content={"detail": exc.message}
    )
mrwan200 commented 3 years ago

Oh I forgot added and It's fixed ;-; Thank you 😂