Reputation: 1156
I am using Access Management(OPENAM) version 6.5 and ASP.NET Core 2.1. I have created simple mvc web application. I have added “google”, “facebook” external login and as well “openam” as external login. But I got the following error.
HttpRequestException: Response status code does not indicate success: 404 ().
System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
IOException: IDX20804: Unable to retrieve document from: 'http://www.example.com:8080/openam/.well-known/openid-configuration'.
Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(string address, CancellationToken cancel)
InvalidOperationException: IDX20803: Unable to obtain configuration from: 'http://www.example.com:8080/openam/.well-known/openid-configuration'.
Microsoft.IdentityModel.Protocols.ConfigurationManager<T>.GetConfigurationAsync(CancellationToken cancel)
In my program web page http://localhost:44383/, I can click the external login button “Openam”, i want to open the “http://www.example.com:8080/openam/XUI/#login/” login interface.
What am I doing wrong? My code :
public void ConfigureServices(IServiceCollection services) {
..
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddFacebook(options =>
{
options.AppId = "23433128857274851";
options.AppSecret = "dc70a87e2ab33a4fcb6845b55561ac9";
})
.AddGoogle(options =>
{
options.ClientId = "598762028893-hsl3b3bldhoscvi2r8t4tuquf23dn6g.apps.googleusercontent.com";
options.ClientSecret = "3PtzMqjesmCm2TizQpNmDi9";
})
.AddCookie(options =>
{
//options.LoginPath = "/auth/signin";
options.LoginPath = new PathString("/ Account / Login");
options.LogoutPath = new PathString("/ Account / Logout");
})
.AddOpenIdConnect("oidc", options => {
options.Authority = "http://www.example.com:8080/openam";
options.MetadataAddress = "http://www.example.com:8080/openam/.well-known/openid-configuration";
options.ClientId = "ASPNETClient";
options.ClientSecret = "Pa$$w0rd";
options.GetClaimsFromUserInfoEndpoint = true;
options.ResponseType = "id_token";
options.Scope.Clear();
options.Scope.Add("openid");
options.RequireHttpsMetadata = false;
});
}
Upvotes: 0
Views: 433
Reputation: 2744
You need to use
http://www.example.com:8080/openam/oauth2/.well-known/openid-configuration
instead of
http://www.example.com:8080/openam/.well-known/openid-configuration
please see https://backstage.forgerock.com/docs/am/6.5/oidc1-guide/#configure-openid-connect-discovery
Upvotes: 1