@page "/InvalidSession" @using LibMatrix Invalid session

Rory&::MatrixUtils - Invalid session encountered

A session was encountered that is no longer valid. This can happen if you have logged out of the account on another device, or if the access token has expired.

@if (_auth is not null) {

It appears that the affected user is @_auth.UserId (@_auth.DeviceId) on @_auth.Homeserver!

Refresh token Remove @if (_showRefreshDialog) {
Log in @if (_loginException is not null) {
@_loginException.RawContent
}
} } else { Something has gone wrong and the login was not passed along! } @code { [Parameter] [SupplyParameterFromQuery(Name = "ctx")] public string SessionId { get; set; } private UserAuth? _auth { get; set; } private bool _showRefreshDialog { get; set; } private string _password { get; set; } = ""; private MatrixException? _loginException { get; set; } protected override async Task OnInitializedAsync() { var tokens = await sessionStore.GetAllSessions(); if (tokens.Count == 0) { NavigationManager.NavigateTo("/Login"); return; } if (tokens.TryGetValue(SessionId, out var session)) _auth = session.Auth; else Console.WriteLine($"Could not find {SessionId} in stored sessions!"); await base.OnInitializedAsync(); } private async Task RemoveUser() { await sessionStore.RemoveSession(SessionId); await OnInitializedAsync(); } private async Task OpenRefreshDialog() { _showRefreshDialog = true; StateHasChanged(); await Task.CompletedTask; } private async Task SwitchSession(string sessionId) { Console.WriteLine($"Switching to session {sessionId}"); await sessionStore.SetCurrentSession(sessionId); await OnInitializedAsync(); } private async Task TryLogin() { if (_auth is null) throw new NullReferenceException("Login is null!"); try { var result = new UserAuth(await HsProvider.Login(_auth.Homeserver, _auth.UserId, _password)); if (result is null) { Console.WriteLine($"Failed to login to {_auth.Homeserver} as {_auth.UserId}!"); return; } Console.WriteLine($"Obtained access token for {result.UserId}!"); await sessionStore.RemoveSession(SessionId); await sessionStore.AddSession(result); NavigationManager.NavigateTo("/"); } catch (MatrixException e) { Console.WriteLine($"Failed to login to {_auth.Homeserver} as {_auth.UserId}!"); Console.WriteLine(e); _loginException = e; StateHasChanged(); } } }