Description
Describe the bug
When I tried to implement the example from the documentation, namely
<html>
<head>
<script src="keycloak.js"></script>
<script>
function initKeycloak() {
var keycloak = new Keycloak();
keycloak.init().then(function(authenticated) {
alert(authenticated ? 'authenticated' : 'not authenticated');
}).catch(function() {
alert('failed to initialize');
});
}
</script>
</head>
<body onload="initKeycloak()">
<!-- your page content goes here -->
</body>
</html>
I consistently reached the "failed to initialize" alert.
When printing out the error code, it was coming from this line. Upon further debugging, it appears that the variable kc.messageReceiveTimeout
is null, while the default timeout is supposed to be 10000. Studying the initialization, I came to the conclusion that it never gets initialized here, since this if-condition will not be fulfilled if init is not called with a non-empty options parameter. But that is what is being done in the example from the documentation.
So, this is an issue of default parameters not being initialized (or the documentation needs fixing; your team's call ;-))
Version
15.0.1
Expected behavior
I would have expected that default values are set no matter what is passed to the init function.
Actual behavior
As mentioned in the description, my code is reaching the catch
statement.
How to Reproduce?
Just use your example as is from the documentation, point it to an OIDC configured client, and you should be able to reproduce.
Anything else?
No response
Activity