hi Can you share your project source code? Include the steps that I can reproduce locally.
hi
liming.ma@volosoft.com
Can you share how you deployed your application? Can you share the steps to reproduce the issue?
It's hard for me to confirm the problem now, but I can confirm that this is a deployment problem. It has nothing to do with the code
System.UriFormatException: Invalid URI: The hostname could not be parsed.
You can also share the context logs when this exception occor
app.Use(async (httpContext, next) =>
{
var logger = httpContext.RequestServices.GetRequiredService<ILogger<YourModule>>();
try
{
//BaseUri: new Uri(request.Scheme + Uri.SchemeDelimiter + host + request.PathBase, UriKind.Absolute),
// RequestUri: new Uri(request.GetEncodedUrl(), UriKind.Absolute)),
logger.LogError("BaseUri: " + httpContext.Request.Scheme + Uri.SchemeDelimiter + httpContext.Request.Host + httpContext.Request.PathBase);
logger.LogError("RequestUri: " + httpContext.Request.GetEncodedUrl());
}
catch (Exception e)
{
logger.LogError(e, e.Message);
}
await next(httpContext);
});
app.UseAuthentication();
app.UseAuthorization();
hi
I checked the error, and it seems to occur on these lines.
https://github.com/openiddict/openiddict-core/blob/dev/src/OpenIddict.Client.AspNetCore/OpenIddictClientAspNetCoreHandlers.cs#L120-L121
Can you check the HttpRequest
info of your production environment
You can add a middleware to output the HttpRequest
info to logs.
hi Mohammed
context.ProtocolMessage.RedirectUri = "http://localhost:4200";
You should not redirect to angular. It should be redirected to authserver, and then authserver will be redirected to angular.
Or can you explain why you did this?
hi
The token has returned, I guess this is an angular issue. Our angular team will reply to you ASAP. : )
hi
As you see, all url have http protocol.
You can add a middleware force set the scheme as https
app.Use((httpContext, next) =>
{
httpContext.Request.Scheme = "https";
return next();
});
hi
You don't need to clear all the resolvers.
You can add your Contributor
after CurrentUserTenantResolveContributor
options.TenantResolvers.InsertAfter(
r => r is CurrentUserTenantResolveContributor,
new DomainTenantResolveContributor(domainFormat)
);
Please output some logs in your Contributor
then check the logs to see what happened.
hi
The key point is: If you confirm you have found a valid tenant, then set context.Handled = true;
and return a tenant name.