Cognito OpenId 使用 angular-auth-oidc-client 刷新令牌

我正在尝试使用 angular-auth-oidc-client 项目实现刷新令牌路径。第一个刷新令牌可以正常工作,但是如果我导航到不同的页面或刷新页面,我会收到一个错误(启用调试),表明没有可用的刷新令牌。我已将存储设置为 localStorage 以在会话中保留令牌。我在一些答案中看到,在客户端上设置“offline_access”范围可以解决这个问题。但是,Cognito 没有这个范围,也不能通过 CustomScopes 为资源添加,afaik。

我对客户端的设置如下:

    AuthModule.forRoot({
  config: {
    authority: 'https://cognito-idp.us-east-1.amazonaws.com/us-east-myPoolId/.well-known/openid-configuration',redirectUrl: window.location.origin,postLogoutRedirecturi: window.location.origin,clientId: 'myClientId',scope: 'openid profile email',responseType: 'code',silentRenew: true,storage: localStorage,silentRenewUrl: `${window.location.origin}/silent-renew.html`,useRefreshToken: true,renewTimeBeforeTokenExpiresInSeconds: 30,ignoreNonceAfterRefresh: true,logLevel: environment.production ? LogLevel.None : LogLevel.Debug,},}),
hui290021617 回答:Cognito OpenId 使用 angular-auth-oidc-client 刷新令牌

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3397.html

大家都在问