@page "/profile/session" @using Indotalent.ConfigBackEnd.Interfaces @using Indotalent.ConfigFrontEnd.Common @using Indotalent.Infrastructure.Authentication @using Indotalent.Infrastructure.Authentication.Identity @using Microsoft.JSInterop @using MudBlazor @inject ICurrentUserService CurrentUserService @inject TokenProvider TokenProvider @inject IDialogService DialogService @inject ISnackbar Snackbar @inject IJSRuntime JSRuntime Active Session Information Detailed information about your current authentication state.
Full Name @(CurrentUserService.FullName ?? "Not Identified")
User ID @(CurrentUserService.UserId ?? "Not Identified")
Username @(CurrentUserService.UserName ?? "Not Identified")
Email Address @(CurrentUserService.Email ?? "Not Identified")
JSON Web Token (JWT) Copy this token to use in Swagger Authorization.
Copy JWT Token
@code { [Inject] private IHttpContextAccessor HttpContextAccessor { get; set; } = default!; protected override void OnInitialized() { if (string.IsNullOrEmpty(TokenProvider.Token)) { var tokenFromCookie = HttpContextAccessor.HttpContext?.Request.Cookies["X-Auth-Token"]; if (!string.IsNullOrEmpty(tokenFromCookie)) { TokenProvider.Token = tokenFromCookie; } } } private async Task CopyToClipboard() { var tokenValue = TokenProvider.Token; if (string.IsNullOrEmpty(tokenValue)) { Snackbar.Add("Token not found. Please re-login.", Severity.Error); return; } await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", tokenValue); Snackbar.Add("Token copied to clipboard!", Severity.Success); } private async Task ShowJwtDialog() { var tokenValue = TokenProvider.Token; if (string.IsNullOrEmpty(tokenValue)) { await DialogService.ShowMessageBoxAsync("System Note", "Token is not available."); return; } var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; await DialogService.ShowMessageBoxAsync( "Your JWT Token", (MarkupString)$@"

RAW TOKEN:

{tokenValue}
", "Close", options: options ); } }