Closed JeanMenage closed 3 years ago
Yes, it is possible. I'll send you a snippet later this weekend when I'm online. Take a look through the examples. There might be one there.
Simplest way to do this is with a little bit of monkeypatching.
from sanic_jwt.endpoints import VerifyEndpoint
async def custom_get_response(self, request, *args, **kwargs):
return response.json({"foo": "bar"})
VerifyEndpoint.get = custom_get_response
app = Sanic("app")
Initialize(app, authenticate=authenticate)
Can you add a decorator to the monkey-patched function, such as @protected()
or @scoped()
, for instance?
Hi ! First of all, thansk a lot for your work, it's really helpfull. I've seen that default responses endpoints can be changed however for exemple with the verify endpoint I would like to be able to remove the line '"valid":true', I can't find how to do it or if that's possible tho. Thanks !