You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to add a claim on the token, based on something else apart from user. The classmethod get_token only accepts user as an argument, allowing to add claims related directly to the user.
However, I want to add a claim that is related to the user and to the request. It's kind of a tenant claim, which is specified on the sign-in request. It is validated to check if the user has access to the tenant, but the relationship between the user and the tenant is M2M, meaning that I can't get this information from the user alone.
I need to access it from context, but as get_token is a classmethod, I don't have access to it. Is this possible?
The text was updated successfully, but these errors were encountered:
I have the same use case, I would like to add the tenant claim in the JWT so that each authenticated request is associated with one without having to set an extra header.
I want to be able to add a claim on the token, based on something else apart from user. The classmethod
get_token
only acceptsuser
as an argument, allowing to add claims related directly to the user.However, I want to add a claim that is related to the user and to the request. It's kind of a
tenant
claim, which is specified on the sign-in request. It is validated to check if the user has access to the tenant, but the relationship between the user and the tenant is M2M, meaning that I can't get this information from the user alone.I need to access it from context, but as
get_token
is a classmethod, I don't have access to it. Is this possible?The text was updated successfully, but these errors were encountered: