I am trying to install keycloak-js in my vue project as described in this tutorial and when I start my application I keep getting the error
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_3_keycloak_js__ is not a function
These are my entries in package.json
"keycloak-js": "^7.0.0",
"vue": "^2.5.2",
"webpack": "^3.6.0",
Like in the tutorial I import it with import * as Keycloak from 'keycloak-js' and start it with let keycloak = Keycloak(initOptions) which is the line that throws the error.
I also tried to require keycloak and then it just said Keycloak is not a function.
Could this error be webpack-related? This is imho the only difference between the tutorial and my application. I haven't found anyone else having the same problem.
A co-worker just told me to try an older version of Keycloak and now it works.
"keycloak-js": "^6.0.1",
This is supposedly a bug in keycloak.js version 7.0.0 itself and as far as I know will be patched very soon. Until then I would stick to the latest 6.* version, which is 6.0.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With