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 摘要。