oidc-client js 在 Safari / FF 中失败

oidc-client js failing in Safari / FF

我有一个带有用于身份验证的 oidc 客户端的 Angular 应用程序,代码在 Chrome 和 Edge 上工作正常,但是当我尝试使用 Safari 进行身份验证时,它在几个 retries/errors 之后工作对于 Firefox,它根本不起作用。我得到的错误是:

    Error: Uncaught (in promise): Error: No matching state found in storage
x</t.prototype.processSigninResponse/<@webpack-internal:///../../../../oidc-client/lib/oidc-client.min.js:1:5057
ZoneDelegate.prototype.invoke@webpack-internal:///../../../../zone.js/dist/zone.js:388:17
onInvoke@webpack-internal:///../../../core/esm5/core.js:4947:24
ZoneDelegate.prototype.invoke@webpack-internal:///../../../../zone.js/dist/zone.js:387:17
Zone.prototype.run@webpack-internal:///../../../../zone.js/dist/zone.js:138:24
scheduleResolveOrReject/<@webpack-internal:///../../../../zone.js/dist/zone.js:858:52
ZoneDelegate.prototype.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:421:17
onInvokeTask@webpack-internal:///../../../core/esm5/core.js:4938:24
ZoneDelegate.prototype.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:420:17
Zone.prototype.runTask@webpack-internal:///../../../../zone.js/dist/zone.js:188:28
drainMicroTaskQueue@webpack-internal:///../../../../zone.js/dist/zone.js:595:25

Stack trace:
resolvePromise@webpack-internal:///../../../../zone.js/dist/zone.js:809:31
resolvePromise@webpack-internal:///../../../../zone.js/dist/zone.js:775:17
scheduleResolveOrReject/<@webpack-internal:///../../../../zone.js/dist/zone.js:858:17
ZoneDelegate.prototype.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:421:17
onInvokeTask@webpack-internal:///../../../core/esm5/core.js:4938:24
ZoneDelegate.prototype.invokeTask@webpack-internal:///../../../../zone.js/dist/zone.js:420:17
Zone.prototype.runTask@webpack-internal:///../../../../zone.js/dist/zone.js:188:28
drainMicroTaskQueue@webpack-internal:///../../../../zone.js/dist/zone.js:595:25

在我看来,它必须按照浏览器管理存储的方式执行,但我不确定这是否是其他原因。我拥有的版本:

"@angular/animations": "5.2.1",
    "@angular/common": "5.2.1",
    "@angular/compiler": "5.2.1",
    "@angular/core": "5.2.1",
    "@angular/forms": "5.2.1",
    "@angular/http": "5.2.1",
    "@angular/platform-browser": "5.2.1",
    "@angular/platform-browser-dynamic": "5.2.1",
    "@angular/platform-server": "5.2.1",
    "@angular/router": "5.2.1",
    "@ng-bootstrap/ng-bootstrap": "1.0.0",
    "@nguniversal/express-engine": "5.0.0-beta.5",
    "@nguniversal/module-map-ngfactory-loader": "5.0.0-beta.5",
    "bootstrap": "4.0.0-beta.2",
    "core-js": "2.5.3",
    "font-awesome": "4.7.0",
    "oidc-client": "1.4.1",
    "rxjs": "5.5.6",
    "zone.js": "0.8.20"

认证回调的处理代码超级简单:

completeAuthentication(): Promise<void> {
        if (isPlatformBrowser(this.platformId)) {
            return this.manager.signinRedirectCallback()
                               .then(user => {
                                    this.user = user;
                               });
        }
    }

其中 manager 是一个 UserManager 实例:

@Injectable()
export class AuthService {
    private manager: UserManager;
    private user: User = null;

    constructor(@Inject(PLATFORM_ID) private platformId: Object) {
        if (isPlatformBrowser(platformId)) {
            this.manager = new UserManager(getClientSettings());
            this.manager.getUser().then(user => {
                this.user = user;
            });
        }

知道为什么相同的代码在不同的浏览器上会失败吗?

我意识到我正在独立于实际 completeAuthentication() 承诺执行重定向,因此我遇到了失败。我只是将它添加到 then 上,一切都运行良好。