Keycloak Linking

I created Parse client App based on REST Guide. And I used Keycloak as auth. I used this doc to do the linking: I also used this doc to get authData:

But I get error on the server:

Unexpected token u in JSON at position 0

this is my body:

{ "authData": { "keycloak": { "access_token": "eyJhbGciOiJSUzI1NiIsInR5...", "id": "lake", "roles": [], "groups": [] } } }

Could anyone help? Please.
or is there any tutorial how to link Keycloak from SDK REST Client to Parse Server?

Could you share the code for this request which is firing the error?

I tried post the params using Talend API Tester.
This is the request screenshoot:

and this is the Parse Server config:

{ "databaseURI": "mongodb://admin:[email protected]/pserver?authSource=admin", "appId": "APP_ID", "masterKey": "MASTER_KEY", "readOnlyMasterKey": "READ_ONLY_MASTER_KEY", "restAPIKey": "REST_API_KEY", "javascriptKey": "JAVASCRIPT_KEY", "serverURL": "http://localhost:1337/parse", "publicServerURL": "http://localhost:1337/parse", "mountGraphQL": true, "mountPlayground": true, "auth": { "keycloak": { "config": { "realm": "laker", "auth-server-url": "http://localhost:8080/auth/", "ssl-required": "none", "resource": "lake", "public-client": true, "confidential-port": 0 } } } }

Where do you see the error?

In parse-server log (terminal)

It looks the error is coming from this line: parse-server/keycloak.js at master · parse-community/parse-server · GitHub

Maybe we should log the string in the case it cannot be parsed. Anyways, it looks you are getting some error when trying to authenticate to Keycloak server (which will be hard to debug because of this json parse problem I mentioned before).

Is this address right? “auth-server-url”: “http://localhost:8080/auth/

Maybe you can try to perform this api call and see the error:parse-server/keycloak.js at master · parse-community/parse-server · GitHub

Yes the address is correct.
I am not sure to perform.
But thank you for your information.

After trying to solve:
The problem is: while request to keycloak server. I should use get option format manually like this:

{ host: "", port: 80, method: 'GET', path: "/auth/realms/myrealm/protocol/openid-connect/userinfo", headers: { Authorization: 'Bearer eyJ...' } }

is there any method to do that without manually?
Could any one help?

In order to achieve that, I believe you should set your Parse Server config with auth-server-url to and realm to myrealm.

It doesnt work. The problem is in httpRequest, I have tried manually add to the file. The problem is just my Parse server cannot send the request except use manual code (like I wrote before). When I write auth-server-url config using base url, then the path /auth doesnt included.

I didn’t get it. Would you mind to share your current config and what you get?

this is the snippet code from lib/Adapters/Auth/httpsRequest.js:

function get(options, noJSON = false) {

// console.log(options);

options = {

host: "",

port: 80,

method: 'GET',

path: "/auth/realms/laker/protocol/openid-connect/userinfo",

headers: {

  Authorization: 'Bearer eyJ...'



return new Promise((resolve, reject) => {

https.get(options, makeCallback(resolve, reject, noJSON)).on('error', reject);



I replaced default options with my code manually, and it works. But if I remove my code, it doesnt work. even I modify my config like you said before.

Have you tried with with auth-server-url to and realm to laker ?

I’m not sure if that’s possible to use as a host, but /auth is missing in the beginning of the path.