'Why do I have a error when I use help me please keycloak.init?
how can I solve this problem? help me please keycloak.init({ onLoad: 'login-required' }).success(function () {}
TypeError: keycloak.init is not a function
Solution 1:[1]
Instead of :
const keycloak = Keycloak('./public/keycloak.json');
Try this:
const keycloak = Keycloak('/keycloak.json');
and set promiseType to native in the init options like this(in your case) :
keycloak.init({onLoad: 'login-required', promiseType: 'native'}).then(authenticated => {
this.setState({ keycloak: keycloak, authenticated: authenticated })
})
Share E
Solution 2:[2]
instead of :
const keycloak = Keycloak('./public/keycloak.json');
Try this:
const keycloak = Keycloak('/keycloak.json');
and set promiseType to native in the init options like this(in your case) :
keycloak.init({onLoad: 'login-required', promiseType: 'native'})
.then(authenticated => { this.setState({ keycloak: keycloak, authenticated: authenticated }) })
Solution 3:[3]
it is a good answer thank you very much
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lee Taylor |
| Solution 2 | Lee Taylor |
| Solution 3 | dong wei |
