Closed sicenul closed 2 years ago
Hi, I use HTTPBasicAuth, and when unauthorized, it will return "Unauthorized Access" response. Is it possible to change the response? and please show me how? for example, I want json response like this:
{ "status": false, "code": 401, "message": "some message" }
Thank you.
Use the error_handler decorator:
error_handler
@auth.error_handler def auth_error(status): return { "status": False, "code": 401, "message": "some message" }, 401
Nice, thanks.
Hi, I use HTTPBasicAuth, and when unauthorized, it will return "Unauthorized Access" response. Is it possible to change the response? and please show me how? for example, I want json response like this:
Thank you.