You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have made some updates to your code in the class Auth0AuthenticationStateProvider to allow users to remain logged in after closing their browser in the maui blazor application.Specifically, I updated the method GetAuthenticationStateAsync to include the functionality of storing the token in localstorage/sessionstorage. Here is the updated code for your reference:
`public override async Task<AuthenticationState> GetAuthenticationStateAsync()
{
string jsonWebToken = null;
if (await _localStorageService.ContainKeyAsync(authEntrykey)) {
jsonWebToken = await _sessionStorageService.GetItemAsStringAsync(authEntrykey);
}
if (jsonWebToken == null)
{
return new AuthenticationState(currentUser);
}
else
{
return new AuthenticationState(new ClaimsPrincipal(currentUser));
}
}
`
In addition, I updated the LogIn method as follows to ensure the user is redirected to the correct page after logging in:
and it doesn't seem to be working. Would it be possible for you to retest and correct the code updated so that all users can benefit from this new functionality? Thank you for your assistance.
The text was updated successfully, but these errors were encountered:
MOAnfaDaniel922
changed the title
To add /read token in SessionStorage/LocalStorage from your maui blazor code
use Token in SessionStorage/LocalStorage from your maui blazor code
Mar 31, 2023
@MOAnfaDaniel922, thanks for the feedback and your code snippets. Unfortunately because of time constraints I have not been able to focus on the MAUI project as I hoped and have set it aside for the time being. I do intend getting back to it at some point and will pick up your suggestions then.
I have made some updates to your code in the class Auth0AuthenticationStateProvider to allow users to remain logged in after closing their browser in the maui blazor application.Specifically, I updated the method GetAuthenticationStateAsync to include the functionality of storing the token in localstorage/sessionstorage. Here is the updated code for your reference:
`
In addition, I updated the LogIn method as follows to ensure the user is redirected to the correct page after logging in:
and it doesn't seem to be working. Would it be possible for you to retest and correct the code updated so that all users can benefit from this new functionality? Thank you for your assistance.
The text was updated successfully, but these errors were encountered: