@page "/Login" @using MatrixRoomUtils.Authentication @inject ILocalStorageService LocalStorage

Login






@code { string homeserver = ""; string username = ""; string password = ""; async Task Login() { var result = await MatrixAuth.Login(homeserver, username, password); Console.WriteLine($"Obtained access token for {result.UserId}!"); RuntimeCache.AccessToken = result.AccessToken; var userinfo = new UserInfo() { LoginResponse = result, AccessToken = result.AccessToken, Profile = await MatrixAuth.GetProfile(result.HomeServer, result.UserId) }; //TODO: refactor RuntimeCache.LoginSessions.Add(userinfo.AccessToken, userinfo); RuntimeCache.CurrentHomeserver = await MatrixAuth.ResolveHomeserverFromWellKnown(result.HomeServer); await LocalStorageWrapper.SaveToLocalStorage(LocalStorage); } }