[keycloak-user] Getting logged in user through Node API's

Rushil Agarwal rushil.vaish at gmail.com
Wed Dec 23 08:43:09 EST 2015


Hi Team,

Kindly help in getting some help in fetching logged in user through Node
API's.
I have attached code what I have written in previous mail.

Thanks in advance.

On Tue, Dec 22, 2015 at 3:58 AM, Rushil Agarwal <rushil.vaish at gmail.com>
wrote:

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



-- 
-- 
*With best regards :-*

Rushil Agarwal

Mobile: +91 78298 86000

Please don't print this e-mail unless you really need to. SAVE PAPER TO
SAVE TREES
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151223/763de637/attachment.html 


More information about the keycloak-user mailing list