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