Ratelimit user_id for JWT access token , IP address for endpoint having not token. #48
Unanswered
apptechxonia
asked this question in
Q&A
Replies: 1 comment 9 replies
-
Please read README async def AUTH_FUNCTION(scope: Scope) -> Tuple[str, str]:
"""
Resolve the user's unique identifier and the user's group from ASGI SCOPE.
If there is no user information, it should raise `EmptyInformation`.
If there is no group information, it should return "default".
"""
# FIXME
# You must write the logic of this function yourself,
# or use the function in the following document directly.
return USER_UNIQUE_ID, GROUP_NAME |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
using https://indominusbyte.github.io/fastapi-jwt-auth/ for JWT auth. My requirement is to ratelimit users based on client ip address not having token . For endpoint having access token , user_id is in access token and want to ratelimit that user_id. While using another ratelimiter slowapi, folllowing code worked fine. How to define auth_function while using this ratelimit.
Beta Was this translation helpful? Give feedback.
All reactions