AWS amplify google sigin with react 不会在 1 小时后自动刷新令牌?
AWS amplify google sigin with react doesn't automatically refresh token after 1 hour?
使用隐式授权流程(使用 Auth.oauth.responseType = 'token' 配置的 Amplify),从 Cognito Hosted UI 重定向后,idToken 和 accessToken 被正确填充,refreshToken 保持为空 - 因为它应该是:
如果您在 React 应用程序中提供了该代码片段,则会发生自动刷新令牌。该库需要在不添加 refreshHandlers 回调的情况下刷新令牌。文档是这么说的,但没有用。
有人可以帮助我如何为使用 AWS Amplify
的用户刷新令牌吗?
没有要刷新的刷新令牌,因为您使用的是隐式授权类型而不是授权代码授权类型。将授权类型从 token
更改为 code
然后您将在调试日志中看到一个刷新标记。
根据 AWS Mobile Blog:
the implicit grant does not generate refresh tokens
将您传递给 Amplify.configure
的身份验证选项更改为如下所示:
Amplify.configure({
Auth: {
// other configurations...
// ...
oauth: {
// ...
responseType = 'code'
}
// ...
}
});
使用隐式授权流程(使用 Auth.oauth.responseType = 'token' 配置的 Amplify),从 Cognito Hosted UI 重定向后,idToken 和 accessToken 被正确填充,refreshToken 保持为空 - 因为它应该是:
如果您在 React 应用程序中提供了该代码片段,则会发生自动刷新令牌。该库需要在不添加 refreshHandlers 回调的情况下刷新令牌。文档是这么说的,但没有用。
有人可以帮助我如何为使用 AWS Amplify
的用户刷新令牌吗?
没有要刷新的刷新令牌,因为您使用的是隐式授权类型而不是授权代码授权类型。将授权类型从 token
更改为 code
然后您将在调试日志中看到一个刷新标记。
根据 AWS Mobile Blog:
the implicit grant does not generate refresh tokens
将您传递给 Amplify.configure
的身份验证选项更改为如下所示:
Amplify.configure({
Auth: {
// other configurations...
// ...
oauth: {
// ...
responseType = 'code'
}
// ...
}
});