Blazor WASM App 驗證與授權
先給結論
跟 Blazer Server App 一樣都是用 AuthenticationStateProvider
為中心來實作。
存放登入Token的地方為瀏覽器的 windows.localStorage
。(沒有更好的地方嗎?)
記得登入狀態改變時,不管登入或登出都要用 NotifyAuthenticationStateChanged
函式向外通知。
這篇文章的 WASM 驗證方法是 .NET5 時期的解法,在這一版 .NET6 仍有效用。
這篇文章有登入流程圖
Part 1
Part 2
Last updated