We have Angular portal which communicates with identity server 4 and it works well with our own domain. We want to add support for custom domain and for that we are storing domain name in our database and whenever any angular portal link is opened, we grab the domain name from database and assign to authConfig as shown below:
Object.assign(authConfig, { issuer: domainNam });
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
// .... rest of the code
});
It sets the domain name currently for issuer but it does not redirect to login page but instead it is showing me below error:
The link is made like this:
What is going wrong here?
If issuer is not set then it works fine but when I dynamically set issuer, it is creating this problem.
authConfig is as below:
export const authConfig: AuthConfig = {
// Url of the Identity Provider
issuer: environment.identityServer.authority,
// URL of the SPA to redirect the user to after login
redirectUri: window.location.origin + "/auth-callback",
// The SPA's id. The SPA is registerd with this id at the auth-server
clientId: environment.identityServer.client_id,
// set the scope for the permissions the client should request
// The first three are defined by OIDC. The 4th is a usecase-specific one
scope: environment.identityServer.scope,
logoutUrl: environment.identityServer.authority + '/Account/Logout',
}