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

updateToken Cannot assign to read only property 'tokenTimeoutHandle' of object '[object Object]' #576

Open
ekrem-kocak opened this issue Sep 10, 2024 · 0 comments

Comments

@ekrem-kocak
Copy link

ekrem-kocak commented Sep 10, 2024

"@angular/common": "~17.3.0",
"keycloak-angular": "^15.3.0",
"keycloak-js": "^24.0.5"

When I call the updateToken() function from either the instance or KeycloakService, I receive the following error:

interval(10000).subscribe(() => {
          if (instance.token) {
            this.keycloakService
              .updateToken(290)
              .then((r) => {
                console.log(r);
              })
              .catch((e) => {
                console.error(e);
              });
          }
        });

The error message is:

zone.js:1695

Uncaught TypeError: Cannot assign to read only property 'tokenTimeoutHandle' of object '[object Object]'
    at setToken (keycloak.mjs:987:34)
    at req.onreadystatechange [as __zone_symbol__ON_PROPERTYreadystatechange] (keycloak.mjs:674:33)
    at XMLHttpRequest.wrapFn (zone.js:758:39)
    at _ZoneDelegate.invokeTask (zone.js:403:31)
    at Zone.runTask (zone.js:174:47)
    at ZoneTask.invokeTask [as invoke] (zone.js:484:34)
    at invokeTask (zone.js:1645:18)
    at globalCallback (zone.js:1676:29)
    at XMLHttpRequest.globalZoneAwareCallback (zone.js:1709:16)

Could you please help me with this issue?

image

image

image

I believe the issue is that kc.tokenTimeoutHandle is read-only, so it cannot be set to null. As a result, it throws an error, and the function does not work.

@ekrem-kocak ekrem-kocak changed the title updateToken read only property 'tokenTimeoutHandle' of object '[object Object]' updateToken Cannot assign to read only property 'tokenTimeoutHandle' of object '[object Object]' Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant