How to properly delay a guard until angular knows the definitive session state
- 主要語言
- TypeScript
- 星號
- 7.8k
- 分支
- 2.2k
- 平均合併
- 22 小時 28 分鐘
- 30 天內合併 PR
- 6
描述
Angular 19
Hi, I have been playing around learning how to protect some routes with authentication
my problem is that the user state takes a moment to properly notify the final resolution
meaning that, if a user is authenticated and access to a protected route, the user state returns null and then the user, breaking the protection
I have been trying different techniques like BehaviorSubject and filtering the undefined state to know that firebase still didn't provide a final state
I have also found a guy getting the session from the cookies https://medium.com/@ignatovich.dm/securing-angular-applications-with-route-guards-and-firebase-auth-54c02bdd4811 it is sync and with a straight answer
if I could find some examples for these use cases I will appreciate !
貢獻指南
研究方向
未指定檔案、測試或進入點;該 issue 要求提供有關如何延遲 Angular route guards,直到 Firebase 驗證完成解析的指引。首先釐清 AngularFire API 或範例的預期範圍,接著記錄一個可重現的已驗證路由範例,並驗證在尚未解析的狀態期間不會發生重新導向。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, firebase, typescript
- 領域
- authentication, frontend
- Issue 類型
- 文件
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100