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'm working on a Blazor Server app and have been tasked with creating a desktop version of the app. I have been trying to use Electron.NET, but I am running into issues when authenticating through Azure AD while using Electron.NET. I'm receiving the following error:
stdout: fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HN2V44AL6L5H", Request id "0HN2V44AL6L5H:00000002": An unhandled exception was thrown by the application. System.Exception: An error was encountered while handling the remote login. ---> System.Exception: Correlation failed. --- End of inner exception stack trace --- at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleRequestAsync() at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)
When I remove the authentication service, or I do not use Electron, it works. It seems to be caused by the cookie "SameSite=None" since the secure cookie is not set to secure.
I have tried adding a cookie policy to the app service by using the following: app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMode.Lax });
but this did not fix my issue. I also tried adding it to the authentication service: builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddCookie(options => { options.Cookie.SameSite = SameSiteMode.Lax; }).AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAD")); but this also did not work
Steps to Reproduce:
Register an app on Azure -> Microsoft EntraID
Add Azure AD authentication to the app builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAD"));
Run app and log in via Microsoft account.
Set up electron
Run app again and receive error message instead of login screen
The text was updated successfully, but these errors were encountered:
Versions:
Target: Windows
I'm working on a Blazor Server app and have been tasked with creating a desktop version of the app. I have been trying to use Electron.NET, but I am running into issues when authenticating through Azure AD while using Electron.NET. I'm receiving the following error:
stdout: fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HN2V44AL6L5H", Request id "0HN2V44AL6L5H:00000002": An unhandled exception was thrown by the application. System.Exception: An error was encountered while handling the remote login. ---> System.Exception: Correlation failed. --- End of inner exception stack trace --- at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleRequestAsync() at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)
When I remove the authentication service, or I do not use Electron, it works. It seems to be caused by the cookie "SameSite=None" since the secure cookie is not set to secure.
I have tried adding a cookie policy to the app service by using the following:
app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMode.Lax });
but this did not fix my issue. I also tried adding it to the authentication service:
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddCookie(options => { options.Cookie.SameSite = SameSiteMode.Lax; }).AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAD"));
but this also did not workSteps to Reproduce:
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAD"));
The text was updated successfully, but these errors were encountered: