【问题标题】:How to handle oidc silent renew error如何处理 oidc 静默续订错误
【发布时间】:2018-06-13 15:44:56
【问题描述】:

我有一个使用 redux-oidc 对身份服务器进行身份验证的设置。 我可以登录,我可以看到在令牌过期时,silenRenew 按预期工作。

但是有一个问题。 如果我打开我的网站并让计算机进入睡眠状态,当我在过期后返回时,静默更新失败并出现以下错误:

帧窗口超时

一旦我唤醒计算机,它就不会再试一次。甚至当我重新加载页面时也没有。

这是预期的行为吗?

如果是这样,处理此问题的正确方法是什么,以免网站死机?

如果没有,有没有人知道我可能做错了什么?

【问题讨论】:

    标签: reactjs redux openid-connect oidc-client-js


    【解决方案1】:

    我遇到过类似的问题,所以我做了一个看起来很丑但对我来说仍然很好的变通方法,在代码中查找 cmets

     this.userManager = new Oidc.UserManager(oidcSettings);
    
                this.userManager.events.addAccessTokenExpiring(() =>
                {
                    this.userManager.signinSilent({scope: oidcSettings.scope, response_type: oidcSettings.response_type})
                        .then((user: Oidc.User) =>
                        {
                            this.handleUser(user);
                        })
                        .catch((error: Error) =>
                        {
                            // Currently as a dirty work around (looks like problem with gluu server. Need to test with other IDP's as well)
                            // in order to get the new issued token I just calling getUser() straight after signinSilent().then() promise failing with frame time out
                            // https://github.com/IdentityModel/oidc-client-js/issues/362
                            this.userManager.getUser()
                                .then((user: Oidc.User) =>
                                {
                                    this.handleUser(user);
                                });
                        });
                });
    

    【讨论】:

    • 效率不高,但仍然支持这些努力 :-)
    【解决方案2】:

    查看日志。它通常会告诉你出了什么问题。在我遇到此错误的所有情况下,这是由于我错过了服务器上的重定向 uris。您在客户端设置的所有内容都需要反映在服务器上,否则任何回调(例如 IS 示例中的 callback.html、popup.html 和silent.html),会话更新都会失败。

    【讨论】:

      猜你喜欢
      • 2020-04-14
      • 2017-11-19
      • 2018-05-19
      • 2019-12-22
      • 1970-01-01
      • 2018-08-28
      • 2017-06-16
      • 2019-01-25
      • 2021-06-21
      相关资源
      最近更新 更多