Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle Keycloak init failures #565

Open
fogarty-climbs opened this issue Jun 3, 2024 · 1 comment
Open

Gracefully handle Keycloak init failures #565

fogarty-climbs opened this issue Jun 3, 2024 · 1 comment
Assignees
Labels
enhancement This issue/PR is an enhancement or new feature. evaluate-in-next-version Evaluate if the feature or change might be included in the next library release.

Comments

@fogarty-climbs
Copy link

Bug Report or Feature Request (mark with an x)

GIVEN an incorrect BAD_DOMAIN in the Keycloak configuration and Keycloak registered in the App.Module
WHEN the App.Module attempts to compile and initialize Keycloak with a domain that is down
THEN I will encounter a compilation error and will see no useful information and I cannot proceed even if I want anonymous access.

- [x ] bug report -> please search for issues before submitting

Versions.

"@angular/core": "^16.2.12",
"keycloak-angular": "^14.0.0",
"keycloak-js": "^18.0.0",

Repro steps.

  1. Install Angular 16 and Keycloak angular libraries.
  2. Configure kc.init.ts with a BAD_DOMAIN
    keycloakConfig: { url: 'BAD_DOMAIN', realm: 'realm-example', clientId: 'example-client-id', }; return keycloak.init({ config: keycloakConfig, initOptions: { onLoad: 'check-sso', silentCheckSsoFallback: false, silentCheckSsoRedirectUri: document.baseURI + 'assets/silent-check-sso.html', checkLoginIframe: false, enableLogging: true, checkLoginIframeInterval: 10_000, }, bearerExcludedUrls: [ 'https://api-dev.publicrecords.usco.lctl.gov/search_service', 'https://api-test.publicrecords.usco.lctl.gov/search_service', ], enableBearerInterceptor: true, });

The log given by the failure.

You will receive a white-page and Angular compilation stops at App.Module level. No useful information will be rendered or compiled.

Desired functionality.

A graceful failure where the application will render. This is a big blocker for websites that utilize Keycloak for logins but fails if the application needs anonymous access as well. If the Keycloak /auth/ domain is ever down, you will receive the whitepage. An expectation would be if the Keycloak /auth/ domain is down for the application, we would want to disable login features.

@mauriciovigolo mauriciovigolo changed the title If Keycloak Auth Domain is down, then Angular 16 keycloak will receive white-page and fail compilation at AppModule level Gracefully handle Keycloak init failures Dec 24, 2024
@mauriciovigolo mauriciovigolo self-assigned this Dec 24, 2024
@mauriciovigolo mauriciovigolo added enhancement This issue/PR is an enhancement or new feature. evaluate-in-next-version Evaluate if the feature or change might be included in the next library release. labels Dec 24, 2024
@mauriciovigolo
Copy link
Owner

I plan to implement a timeout, and handle any errors that occur during initialization to avoid this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue/PR is an enhancement or new feature. evaluate-in-next-version Evaluate if the feature or change might be included in the next library release.
Projects
None yet
Development

No branches or pull requests

2 participants