且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我不了解JWT刷新令牌的行为(LARAVEL)

更新时间:2023-11-05 19:48:34

访问令牌过期后,您可以使用刷新令牌来获取新的访问令牌,而无需要求用户再次输入用户名和密码. 只有刷新令牌过期后,用户才需要再次登录.

After the access token is expired you can use the refresh token to get a new access token without asking the user to input his username and password again. Only after the refresh token is expired, the user needs to login again.

但是3小时后,如果我尝试查询某些内容,它会显示令牌已过期".

But after 3hours, if i try to query something, it says "token expired".

那是因为访问令牌已过期.

that's because the access token is expired.

此系统是否意味着用户必须在每小时内但不超过2周的时间内更新/刷新其令牌?我不明白.

Does this system mean, a user must get his token updated / refreshed within every hour but with a limit of 2 weeks ? I don't get it.

是的.您将刷新令牌保留在客户端系统中,并在访问令牌过期时使用它来请求新的访问令牌.

yes. You keep the refresh token in your client system and use it to request a new access token when the access token is expired.