如何使用角度为 2 或更大的 aws 放大来刷新 aws-cognito 刷新令牌

时间:2021-02-03 18:52:14

标签: angular amazon-web-services amazon-cognito aws-amplify angular10

项目概要:

在我的一个项目中,我使用 google login 将用户登录到我的应用程序中。它的后端是无服务器 (AWS)

Frontend 是使用 Angular 10 创建的,并且正在使用 AWS Cognito 联合登录进行谷歌登录。在 angular 中,我使用 aws-amplify npm 包 与 aws 交互。

我在 aws-amplify 配置中使用 response type = code 并且在用户登录后获得 idtoken、accesstoken 和 refreshtoken。

我正在使用 Auth.currentSession() 来获取新的 idtoken,如果它们过期,则获取 accesstoken。

idtoken 和 accesstoken 的过期时间是 5 分钟。 refreshtoken 的到期时间为 60 分钟。

注意 - 为了测试目的,上述过期时间已被保留为最短时间。


问题:

一旦我的刷新令牌过期,我就会在调用 Auth.currentSession() 时收到消息“刷新令牌已过期”。

我想知道,有没有办法在过期之前生成新的刷新令牌或增加/刷新过期时间(另外 60 分钟)?

0 个答案:

没有答案