[keycloak-user] Uncaught SyntaxError: Unexpected end of JSON input on tutorial

Viggo Navarsete viggo.navarsete at gmail.com
Mon Jan 29 14:22:05 EST 2018


Hi,

I've installed Wildfly 11.0.0.Final and keycloak 3.4.3.Final and have run
the following tutorials:
https://github.com/keycloak/keycloak-quickstarts/blob/latest/service-jee-jaxrs/README.md
https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-jee-html5

But I end up getting
Uncaught SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at XMLHttpRequest.req.onreadystatechange (app.js:44)

whatever I click on of "Invoke Public, "Invoke Secured" and "Invoke Admin".

Does anyone else have the same problem I have?

It the line in bold that gives the error:
        req.onreadystatechange = function () {
            if (req.readyState == 4) {
                if (req.status == 200) {
                    *output.innerHTML = 'Message: ' +
JSON.parse(req.responseText).message;*
                } else if (req.status == 0) {
                    output.innerHTML = '<span class="error">Request
failed</span>';
                } else {
                    output.innerHTML = '<span class="error">' + req.status
+ ' ' + req.statusText + '</span>';
                }
            }
        };

Regards,
Viggo


More information about the keycloak-user mailing list