I am establishing an Open Id connection for a dummy node application using KeyCloak . I am using the nodejs adapter suggested here in key cloak docs .
Here is the node.'s routes.js file:
'use strict'; const home = require('../app/controllers/home'); module.exports = function (app, passport) { var session = require('express-session'); var Keycloak = require('keycloak-connect'); var memoryStore = new session.MemoryStore(); var keycloak = new Keycloak({ store: memoryStore })
When I access the root url of localhost:3000 , I first redirect to the KeyCloak login KeyCloak . After logging in, I get the following error: 
Here is the node app server log: 
As you can see, it goes into an endless cycle.
Additional Information I found:
In the first redirection after logging in, the state value matches the value before logging in. As can be seen from the above screenshot of the server log, the state value changes with each redirection after that.
From what I have found out so far, the redirect occurs in post-auth.js (line number 49) , resulting in an infinite loop. Here is a link to post-auth.js - https://github.com/keycloak/keycloak-nodejs-connect/blob/master/middleware/post-auth.js
sessionId The getGrantFromCode function in index.js is undefined. Here is the function:
Keycloak.prototype.getGrantFromCode = function (code, request, response) { if (this.stores.length < 2) {
Source Code Link: https://github.com/keycloak/keycloak-nodejs-connect/blob/master/index.js
- Below is an example that I get when I register it with the provision function mentioned above: https://pastebin.com/eqUaiAvb
Questions:
- How can I fix this problem?
- Where can I find keycloak (jboss) logs? Now I can only see keycloak logs only in case of error. I am using
mvn -f testsuite/integration/pom.xml exec:java -Pkeycloak-server to run keycloak. I have never worked on java before. - Where is the request (using the authorization code) for the id token?
Thank you very much in advance.
Ravikanth Andhavarapu
source share