<div dir="ltr">Hi Team,<div><br></div><div>I ave implemented Keycloak using npm package "connect-keycloak"</div><div><br></div><div>I am not able to find any example or help to fetch in the currently logged in userid through Node API's.</div><div>Any help would be appreciated.</div><div><br></div><div>My code snippet:</div><div><br></div><div><b>App.js</b></div><div><div><br></div><div>var memoryStore = new session.MemoryStore();</div><div>var routes = require('./routes/index');</div><div>var users = require('./routes/users');</div><div><br></div><div>app.use( session({</div><div> secret: 'aaslkdhlkhsd',</div><div> resave: false,</div><div> saveUninitialized: true,</div><div> store: memoryStore,</div><div>} ))</div><div><br></div><div>var keycloak = new Keycloak({</div><div> store: memoryStore</div><div>});</div><div><br></div><div>app.use( keycloak.middleware( {</div><div> logout: '/logout',</div><div> admin: '/',</div><div>} ));</div><div><br></div><div><b>Index.js</b></div><div><div>router.get('/',keycloak.protect(),function(req, res, next) {</div><div> </div><div> res.sendfile('pages/index.html',{root:'./public'});</div><div>});</div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><span style="color:rgb(0,0,0);font-family:arial;font-size:small">-- </span><br style="color:rgb(0,0,0);font-family:arial;font-size:small"><b style="color:rgb(0,0,0);font-family:arial;font-size:small">With best regards :-</b><br style="color:rgb(0,0,0);font-family:arial;font-size:small"><font style="font-family:arial;font-size:small" color="#990000"><br></font><div><font style="font-family:arial;font-size:small" color="#990000">Rushil Agarwal</font><div><font color="#990000" face="arial" size="2"><br></font><div><font color="#996633" style="font-family:arial;font-size:small">Mobile: +91 78298 86000</font><div style="color:rgb(0,0,0);font-family:arial;font-size:small"><br></div><div style="color:rgb(0,0,0);font-family:arial;font-size:small"><font color="#006600">Please don't print this e-mail unless you really need to. SAVE PAPER TO SAVE TREES</font></div></div></div></div></div></div>
</div></div>