question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to obtain configuration from: '/.well-known/openid-configuration' when hosted on IIS

See original GitHub issue

Hi

I use Version: OpenIddict 2.0.0-rc2-final OpenIddict.EntityFrameworkCore 2.0.0-rc2-final OpenIddict.Mvc 2.0.0-rc2-final

with the folowing configuration:

services.AddOpenIddict(options =>
{
	// Register the Entity Framework stores.
	options.AddEntityFrameworkCoreStores<AuthContext>();

	options.AddMvcBinders();

	// Enable the token endpoint (required to use the password flow).
	options.EnableTokenEndpoint("/api/authorization/token")
		   .EnableLogoutEndpoint("/api/authorization/logout");

	options.AllowPasswordFlow()
		.AllowRefreshTokenFlow()
		.SetAccessTokenLifetime(TimeSpan.FromHours(2))
		.SetRefreshTokenLifetime(TimeSpan.FromDays(180));

	options.DisableHttpsRequirement();
	options.AddSigningCertificate(cert);
	options.UseJsonWebTokens();
});

//// configure Jwt access token authentication
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
JwtSecurityTokenHandler.DefaultOutboundClaimTypeMap.Clear();

services
	.AddAuthentication(o =>
	{
		o.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
	})
	.AddJwtBearer(options =>
	{
		options.Authority = configuration["JwtConfiguration:Authority"]?.ToString();
		options.Audience = "resource_server";
		options.MetadataAddress = "/.well-known/openid-configuration";
		options.RequireHttpsMetadata = false;
		options.IncludeErrorDetails = true;
		options.TokenValidationParameters = new TokenValidationParameters()
		{
			NameClaimType = OpenIdConnectConstants.Claims.Subject,
			RoleClaimType = OpenIdConnectConstants.Claims.Role,
		};
	});

OpenIddict is included in my API, also my SpaClient runs inside this single Application. If I run this in my Visual Studio with IISExpress everything works fine. But on my Test Server I have this error:

System.InvalidOperationException: IDX10803: Unable to obtain configuration from: ‘/.well-known/openid-configuration’. —> System.IO.IOException: IDX10804: Unable to retrieve document from: ‘/.well-known/openid-configuration’. —> System.InvalidOperationException: An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.

I tried diffrent configurations for the MetadataAddress but nothing works. Local and on the server I can open the endpoint “/.well-known/openid-configuration” without any problem.

I also tried to remove the IP binding from the website as described here: https://github.com/openiddict/openiddict-core/issues/509 sadly with no success.

Any idea what is wrong? After 2 days of try and error on this single problem I run out of ideas…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
muehancommented, Jun 22, 2018

Ok, maybe the problem ist that on the server we have dotnet 4.6.1 and the solution target is net47…

sadly I have to wait until beginning of next week until infrastructure team has installed the new version on the test server… I’m not allowed to do that 😦

so then I close this issue and if I somehow find a fix I add the info here. many thanks for you help and also thanks for the library!

0reactions
AKlauscommented, Sep 27, 2022

Confirm the issue on .NET 6, Windows 10 (doesn’t happen on macOS and Linux). It’s occurred on the client side, so clearly the .NET Identity problem, not OpenIdDict. I suspect it’s caused by a self-issued certificate. Also confirm that setting options.MetadataAddress and options.RequireHttpsMetadata (as discussed above) didn’t make a difference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to obtain configuration from well-known/openid- ...
I used something like this, and it resolved my issue. services.AddAuthentication(o => { o.DefaultAuthenticateScheme = JwtBearerDefaults.
Read more >
Sudden Microsoft Identity error IDX20803
InvalidOperationException: IDX20803 : Unable to obtain configuration from: 'https://login.windows.net/578XXXXXX/v2.0/.well-known/openid- ...
Read more >
"IDX10803: Unable to create to obtain configuration from ...
1. Make sure the SSL certificate uses the same domain as the site is hosted on. · 2. Make sure the SSL certificate...
Read more >
IDX20803: Unable to obtain configuration from: Error ...
I'm using a custom authorization server as I thought the problem was that the default authorization server was too limited. Here is my...
Read more >
Issues
IDX20803 : Unable to obtain configuration from: 'https://localhost/IdentityServer/Core/.well-known/openid-configuration' #4294.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found