简体   繁体   English

使用Sails JS的JWT刷新令牌

[英]JWT Refresh token using Sails JS

I have read a lot of posts but nothing really helped. 我读了很多文章,但没有什么真正的帮助。

I am using a simple auth approach: user logs in, backend checks if its a valid user and gives back an access token using JWT. 我正在使用一种简单的身份验证方法:用户登录,后端检查其是否为有效用户,并使用JWT返回访问令牌。 Now I want to implement a refresh token. 现在,我想实现一个刷新令牌。 How would that be? 那会怎么样 What should be the content of the refresh token? 刷新令牌的内容应该是什么? When I sign a new access token, what should I do to also sign a refresh token and send both of them? 当我签署一个新的访问令牌时,我该怎么做还要签署一个刷新令牌并发送它们两者? When I get an expired access token, how do I verify the refresh token in order to send two new tokens? 当我获得过期的访问令牌时,如何验证刷新令牌才能发送两个新令牌?

Im using Sails JS in the backend, so it would be perfect to have an example with that 我在后端使用Sails JS,因此最好有一个示例

Well, my implementation was to create another different jwtSignature, with a different secret, and that would be my refresh token on the backend. 好吧,我的实现是用另一个秘密创建另一个不同的jwtSignature,这将是后端的刷新令牌。 I know it's not too fancy, but it does the work for now. 我知道这不太花哨,但现在可以完成工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM