这可以使用additional_claims 带有create_access_token()or create_refresh_token()函数的参数来完成。 get_jwt() 函数在受保护的路径中获取额外的数据。 additional_claims参数使用 重要的是要记住 JWT 没有加密,任何有权访问它的人都可以轻松解码 JWT 的内容。因此,您永远不应该将任何敏感信息放在 JWT 中。 官方文档示例 from flask imp
redis_sms_code=redis_sms_code.decode()#2. 从客户端提交的数据data中提取验证码sms_code = data["sms_code"]#3. 字符串比较,如果失败,则抛出异常,否则,直接删除验证码ifsms_code !=redis_sms_code:raiseValidationError(message=Message.sms_code_error, field_name="sms_code") redis.delete("sms_%s"%...
(access_token=access_token)# Endpoint for revoking the current users access token. Save the JWTs unique# identifier (jti) in redis. Also set a Time to Live (TTL) when storing the JWT# so that it will automatically be cleared out of redis after the token expires.@app.route("/logout"...