[keycloak-user] JavaScript adapter: how to get error message

Bruno Oliveira bruno at abstractj.org
Sun May 7 03:59:59 EDT 2017


You cannot get the error_description, because your object "error" does
not exist.

Take a look at the examples[1], it may give you an idea.

[1] - https://github.com/keycloak/keycloak/blob/master/examples/js-console/src/main/webapp/index.html#L139-L143

On 2017-05-06, Mehdi Sheikhalishahi wrote:
> Hi,
>
> With the following code, I am not able to get error message. How should I
> do that? thanks.
>
> Uncaught TypeError: Cannot read property 'error_description' of undefined
>     at Object.errorCallback (index.js:49)
>     at Object.setError (keycloak.js:775)
>     at Object.errorCallback (keycloak.js:198)
>     at Object.setError (keycloak.js:775)
>     at XMLHttpRequest.req.onreadystatechange (keycloak.js:600)
>
> return kc.init({onLoad: 'login-required'}).success(authenticated => {
> console.log("AUTH STATUS: " + authenticated);
> if(!authenticated) {
> kc.login();
> } else {
> dispatch(loginSucceed(kc));
> }}).error(function(error) {
> console.log(error.error_description);
> console.log(error.error);
> console.log(JSON.stringify(error));
> dispatch(loginFailed(JSON.stringify(error)));
> });
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user

--

abstractj


More information about the keycloak-user mailing list