- xyz.com
- yzx.com
- zxy.com
I have these domains and running identity server 4 application with AuthO Openid connections. My primary domain is xyz.com
, so if user login by using another domain like yzx.com
, it will redirect to my primary domain call back path only after AuthO successful login. Because I have registered call back path of my primary domain only in the all the running domains.
See the example below:
var primaryBrandOpenIdRedirectURL = SharedResourceConstants.HyperText + primaryBrandHostUrl + pathBase.GetPathBase(HttpContext) + sso.RedirectPath;
var openIdOptions = new OpenIdConnectOptions
{
ClientId = rijndaelEncryption.Decrypt(sso.ClientId),
ClientSecret = rijndaelEncryption.Decrypt(sso.ClientSecret),
Authority = sso.Authority,
SignInScheme =
IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme,
ForwardSignOut = sso.ForwardSignOut,
// Call back path should be unique.
CallbackPath = new PathString(sso.RedirectPath),
};
if (!organization.IsDefaultBrand)
{
openIdOptions.Events = new OpenIdConnectEvents()
{
OnRedirectToIdentityProvider = ctx =>
{
ctx.ProtocolMessage.RedirectUri = primaryBrandOpenIdRedirectURL;
return Task.FromResult(0);
}
};
}
This working fine in two different localhost ports but in staging facing below issue.
System.Exception: An error was encountered while handling the remote login.
System.Exception: Correlation failed.
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.d__12.MoveNext() at offset 1286
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at offset 17
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task) at offset 39
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) at offset 46
at IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.d__6.MoveNext() at offset 437
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at offset 17
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task) at offset 39
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.d__6.MoveNext() at offset 953
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at offset 17
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task task) at offset 39
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) at offset 46 ```