angular / angular/angularfire

Setting Persistence Doesn't Work

未关闭
#3,131 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
22 小时 28 分钟
30 天内合并 PR
6

描述

Currently running `setPersistence` with any `Persistence` breaks. I was able to work around this by just importing `setPersistence` from `@firebase/auth` instead of `@angular/fire/auth`.

### Version info

**Angular:** 13.1.3

**Firebase:** 9.6.4

**AngularFire:** 7.2.0

**Other (e.g. Ionic/Cordova, Node, browser, operating system):** Node 17.x; OS Windows 11; Browser Chrome;

### How to reproduce these conditions

Try setting persistance:

```ts
setPersistence(this.auth, browserSessionPersistence).catch(console.error);
```

### Debug output

```
TypeError: Class constructor BrowserSessionPersistence cannot be invoked without 'new'
at angular-fire.js:206:29
at angular-fire.js:163:45
at ZoneDelegate.invoke (zone.js:372:1)
at Object.onInvoke (core.mjs:25457:1)
at ZoneDelegate.invoke (zone.js:371:1)
at Zone.run (zone.js:134:1)
at NgZone.run (core.mjs:25311:1)
at run (angular-fire.js:163:35)
at new (angular-fire.js:206:16)
at _getInstance (index-bc414788.js:535:16)
```

### Expected behavior

Setting persistence works.

### Actual behavior

Setting persistence doesn't work.

贡献指南

打开贡献指南

调研方向

首先使用 AngularFire 7.2.0 重现 issue 中描述的 `setPersistence(this.auth, browserSessionPersistence)` 调用,然后将其与从 `@firebase/auth` 导入 `setPersistence` 进行比较。当通过 `@angular/fire/auth` 使用 persistence 且不再出现 `BrowserSessionPersistence` 构造函数错误时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, firebase, typescript
领域
authentication
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。