**when i goto url: http://localhost/signin-oidc
there is error**
An unhandled exception occurred while processing the request.
Exception: Correlation failed.
Unknown location
Exception: An error was encountered while handling the remote login.
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler
Stack Query Cookies Headers
Exception: Correlation failed.
Show raw exception details
Exception: An error was encountered while handling the remote login.
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Show raw exception details
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.RemoteAuthenticationHandler`1.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
here is the startup.cs
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
#region
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.SignInScheme = "Cookies";
options.Authority = "http://localhost/iam.web/identity";
options.RequireHttpsMetadata = false;//
options.ClientId = "NetCoreMvcWeb";//
options.SaveTokens = true;
options.SignedOutRedirectUri = "http://localhost:5000";
options.ResponseMode = "form_post";//
options.ResponseType = "id_token token";//
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("roles");
options.Scope.Add("tlwapi");
});
#endregion
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
// app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
#region
app.UseAuthentication();//
#endregion
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
Not enough info
here is the startup.cs
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
#region
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.SignInScheme = "Cookies";
options.Authority = "http://localhost/iam.web/identity";
options.RequireHttpsMetadata = false;//
options.ClientId = "NetCoreMvcWeb";//
options.SaveTokens = true;
options.SignedOutRedirectUri = "http://localhost:5000";
options.ResponseMode = "form_post";//
options.ResponseType = "id_token token";//
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("roles");
options.Scope.Add("tlwapi");
});
#endregion
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
// app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
#region
app.UseAuthentication();//
#endregion
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
Not enough info
I have the same problem as you. Recently I have been trying to find the answer, but I have not solved it!
Posting all your code doesn't help give info as to what's happening. We don't debug your code for you on this issue tracker. We listen for bug reports in or feature requests for IdentityServer.
Also, given that the error is on the client side, that's all Microsoft code. We don't support their frameworks.
Please give me a definite direction so that I can make some progress in my work again
@wlnh420 Have you solved your problem? If so, please tell me
I am also getting same, but didn't get any solution yet.
I applied the patch but its not a correct solution.
In Configure method of startup.cs
app.UseExceptionHandler("/Home/Error");
In home controller
public IActionResult Error()
{
var exceptionFeature = HttpContext.Features.Get
if (exceptionFeature != null)
{
Exception exceptionThatOccurred = exceptionFeature.Error;
Log.Error(exceptionThatOccurred, "Logged from Home/Error");
string routeWhereExceptionOccurred = exceptionFeature.Path;
if (routeWhereExceptionOccurred.Contains("signin-oidc"))
{
return Redirect("Home/");
}
}
return View();
}
Unfortunately, this will not solve the root cause of my problem, which I will always pay attention to
Yes agree, but on production you need some work around for this issue.
It may be beneficial that, instead of redirecting to "localhost", you mock a domain using your hosts file and redirect to it. Just my $0.02 on the subject.
I've come to understand that this is due to another 500 errors at runtime on your target url, not on the authentication server.
I think this is a problem beyond the authentication configuration
Closing. If you still have issues, feel free to reopen.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.