Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

491
Views
Keycloak-js 'init()' not executing in React app

When I access my app, my Keycloak config is passed to the .init() function to initialize however when I do this, the app stalls and nothing renders on the page, I am not redirected to the keycloak page. The following method is called within index.js before anything is rendered and App should only render upon authentication

const initKeycloak = (onAuthenticatedCallback) => {
  _kc.init({
    onLoad: 'check-sso',
    silentCheckSsoRedirectUri: window.location.origin + '/silent-check-sso.html',
    pkceMethod: 'S256',
  })
    .then((authenticated) => {
      if (!authenticated) {
        doLogin();
      }
      onAuthenticatedCallback();
    })
    .catch(console.error);
};

When I run, nothing loads and the following is repeated over and over in the logs: [HMR] Waiting for update signal from WDS.... I am unable to reach the .then() part of the function. If i remove the auth code, page renders as normal.

NOTE: The keycloak server I am using is a deployed instance and not a local instance. I have checked versions of both keycloak server and keycloak-js and they match

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Add this :

<html>
   <body>
      <script>parent.postMessage(location.href, location.origin)</script>
   </body>
</html>

in your silent-check-sso.html

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!