[英]Get other user jti for flask-jwt-extended
How to get 'jti', not mine but by the "username" ? 如何获得“ jti”而不是我的,而是通过“用户名”? On registration/login jti for access and refresh were assigned to 'username'.
注册/登录时,用于访问和刷新的jti被分配给“用户名”。 All instructions and docs note only how to get my own jti to logout with smth.
所有说明和文档仅说明如何让我自己的jti使用smth注销。 like this code:
像这样的代码:
class UserLogoutRefresh(Resource):
@jwt_refresh_token_required
def post(self):
jti = get_raw_jwt()['jti']
try:
revoked_token = RevokedTokenModel(jti = jti)
revoked_token.add()
return {'message': 'Refresh token has been revoked'},200
except:
return {'message': 'Something went wrong'}, 500
How to get jti for another user. 如何为另一个用户获取jti。 I suppose smth like:
我想像这样:
jti = get_raw_jwt(identity='someusername')['jti']
has to exist for this, who knows ??? 必须为此存在,谁知道呢?
Each token will have a unique jti, it's not scoped per username. 每个令牌都有一个唯一的jti,它不会按用户名限定范围。 If the same user creates 3 tokens, all of them will have a different jti for example.
例如,如果同一用户创建3个令牌,则所有令牌都将具有不同的jti。 If you want to have access to these jti then you will use the decode_token function when you create your token and save it in a datastore somewhere you can look it up later
如果您想访问这些jti,则在创建令牌并将其保存到数据存储中的某个位置时将使用decode_token函数,以后可以查找它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.