Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor Server - User doesn't log in

$
0
0

I have a Blazor app with "InteractiveServer" render mode. After I re-deploy application - strange things happen: despite of cookies still exists (checked developer tools tab Application/Cookies) application behave like user logged out (AuthorizeView works like not authorized). Even when user try to login, it still work the same. But when I manually remove cookies - login works normally.I tried to add clear cookie logic, but it doesn't help at all. Below placed code from my LoginComponent

await JsInterop.ClearAuth();var client = ClientFactory.CreateClient();var apiUrl = ApiConfig.ApiEndpointBaseUrl +"/account/login";var result = await client.PostResultAsJsonAsync<LoginResult, LoginModel>(apiUrl, Model);if (result.Succeeded){    if (result.Value?.Succeeded ?? false)    {        await AuthenticationStateProvider.Login(Model.Email);        await JsInterop.WriteAuth(result);        NavigationManager.NavigateTo(NavigationManager.BaseUri, true);    }}

Any ideas how to fix it?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>