@Localizer[nameof(AppStrings.ForbiddenException)]
@Localizer[nameof(AppStrings.YouAreSignInAs)] @user.GetUserName()
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/NotAuthorizedPage.razor.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/NotAuthorizedPage.razor.cs
index 03ced70bae..993a310cee 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/NotAuthorizedPage.razor.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/NotAuthorizedPage.razor.cs
@@ -21,7 +21,7 @@ protected override async Task OnAfterFirstRenderAsync()
// Following this procedure, the newly acquired access token may now include the necessary roles or claims.
// To prevent infinitie redirect loop, let's append refresh_token=false to the url, so we only redirect in case no refresh_token=false is present
- if (string.IsNullOrEmpty(refresh_token) is false && RedirectUrl?.Contains("refresh_token=false", StringComparison.InvariantCulture) is null or false)
+ if (string.IsNullOrEmpty(refresh_token) is false && RedirectUrl?.Contains("try_refreshing_token=false", StringComparison.InvariantCulture) is null or false)
{
await AuthenticationManager.RefreshToken();
@@ -30,7 +30,7 @@ protected override async Task OnAfterFirstRenderAsync()
if (RedirectUrl is not null)
{
var @char = RedirectUrl.Contains('?') ? '&' : '?'; // The RedirectUrl may already include a query string.
- NavigationManager.NavigateTo($"{RedirectUrl}{@char}refresh_token=false");
+ NavigationManager.NavigateTo($"{RedirectUrl}{@char}try_refreshing_token=false");
}
}
}
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs
index 0ccec88070..e8e83b7b07 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/AuthenticationManager.cs
@@ -61,7 +61,6 @@ public override async Task GetAuthenticationStateAsync()
try
{
var refreshTokenResponse = await identityController.Refresh(new() { RefreshToken = refresh_token });
-
await StoreToken(refreshTokenResponse!);
access_token = refreshTokenResponse!.AccessToken;
}
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPrerenderStateService.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPrerenderStateService.cs
index 4ef4bca93d..d0f897c997 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPrerenderStateService.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/Contracts/IPrerenderStateService.cs
@@ -1,4 +1,6 @@
-namespace Boilerplate.Client.Core.Services.Contracts;
+using System.Runtime.CompilerServices;
+
+namespace Boilerplate.Client.Core.Services.Contracts;
///
/// This service simplifies the process of persisting application state in Pre-Rendering mode
@@ -13,5 +15,10 @@ public interface IPrerenderStateService
/// one can easily use the following method ( ) in the OnInit lifecycle method of the Blazor components or pages
/// to retrieve everything that requires an async-await (like current user's info).
///
+ Task GetValue(Func> factory,
+ [CallerLineNumber] int lineNumber = 0,
+ [CallerMemberName] string memberName = "",
+ [CallerFilePath] string filePath = "");
+
Task GetValue(string key, Func> factory);
}
diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs
index 30afb679fa..2746f63f38 100644
--- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs
+++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PrerenderStateService.cs
@@ -1,5 +1,7 @@
//-:cnd:noEmit
+using System.Runtime.CompilerServices;
+
namespace Boilerplate.Client.Core.Services;
///
@@ -17,6 +19,19 @@ public PrerenderStateService(PersistentComponentState? persistentComponentState
this.persistentComponentState = persistentComponentState;
}
+ public async Task GetValue(Func> factory,
+ [CallerLineNumber] int lineNumber = 0,
+ [CallerMemberName] string memberName = "",
+ [CallerFilePath] string filePath = "")
+ {
+ if (AppRenderMode.PrerenderEnabled is false)
+ return await factory();
+
+ string key = $"{filePath.Split('\\').LastOrDefault()} {memberName} {lineNumber}";
+
+ return await GetValue(key, factory);
+ }
+
public async Task GetValue(string key, Func> factory)
{
if (AppRenderMode.PrerenderEnabled is false)