Closed zwjat closed 4 years ago
For the sake of anyone else that stumbles upon this: see docs
Either on the endpoint:
@sanicjwt.protected(redirect_on_fail=True, redirect_url="/unprotected")
async def my_protected_static(request):
return text("", status=200)
Or globally:
sanicjwt = Initialize(
..., login_redirect_url="/unprotected"
)
When a route is protected, request to it will result Unauthorized exception. But I want to redirect login page to fill username and password to authenticate. I am sorry I don't know where and how I can put code to inplement it. Could anyone help me ? Thank a lot.