Error loading discovery document and blocked by CORS policy

I am using the npm package “angular-oauth2-oidc 13.0.1” for OIDC authentication with InitCodeFlow and loadDiscoveryDocumentAndTryLogin with below auth config. But it throw the below errors and I have set the origin in keycloak client dashboard to specific url as well as ‘*’.

  let authConfig = new AuthConfig();
        authConfig.loginUrl = "https://{Host}/realms/{real-name}/protocol/openid-connect/auth";
        authConfig.issuer = "https://{Host}/realms/{real-name}/";
        authConfig.tokenEndpoint="https://{Host}/realms/{real-name}/protocol/openid-connect/token"
        authConfig.skipIssuerCheck = loginProvider.additionalParams['ValidateIssuer'] === 'false';
        authConfig.clientId = loginProvider.clientId;
        authConfig.responseType = 'code';
        authConfig.redirectUri = window.location.origin + '/account/login';
        authConfig.scope = 'openid profile email';  
        authConfig.customQueryParams={'grant_type':'client_credentials'};
        //authConfig.showDebugInformation=true;   
        authConfig.strictDiscoveryDocumentValidation=false;
        return authConfig;

Error Message:

Response Message:

message: "Http failure response for https://{Host}/realms/{real-name}/.well-known/openid-configuration: 0 Unknown Error"
name: "HttpErrorResponse"
ok: false
status: 0
statusText: "Unknown Error"
url: "https://{Host}/realms/{real-name}/.well-known/openid-configuration"