刷新令牌使用 [英] Refresh Token usage

查看:73
本文介绍了刷新令牌使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现以下场景:

  • 两台或多台设备需要同时登录凭据

  • Two or more device need to be logged in at the same time with same credentials

由一个(或多个)设备按顺序消耗刷新令牌生成另一个令牌

By one (or more) device consumes the refresh token in order to generate another token

其他设备继续登录.换句话说,其他设备设备必须能够使用相同的刷新令牌才能在其他时间生成另一​​个访问令牌

Other devices continue to be logged in. In other words, other devices must be able to use the same refresh token in order to generate another access token at some other time

实际发生的情况是,第一个使用刷新令牌的设备使刷新令牌对其他设备无效,因此其他设备无法使用无效的刷新令牌再次生成访问令牌.

Actually happens is that the first device that uses the refresh token makes the refresh token invalid for other devices, so other devices can not generate the access token again with the invalidated refresh token.

推荐答案

我们不能对不同的设备使用相同的访问令牌.由于一台设备刷新令牌,因此其他设备无法使用现有的访问令牌.这是正确的行为.我建议为每个设备使用一个范围并使用相同的凭据.您可以使用设备 ID 作为范围,然后它为每个设备创建不同的访问/刷新令牌,设备可以使用相同的凭据但不同的访问令牌.

We cannot use same access token for different devices. Since one device refresh the token then others can not use the existing access token. That is the correct behavior. I suggesting to use a scope for each device and use same credential. You can use device id as the scope, then it create a different access/refresh tokens for each device and devices can work with same credentials but different access token.

这篇关于刷新令牌使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆