Node-red begin a session

1,731 views
Skip to first unread message

ernon...@yahoo.fr

unread,
Nov 11, 2014, 2:32:50 PM11/11/14
to node...@googlegroups.com
Hello,

I'm trying to implement some few pages using Node-red "http in" node, and so on ..
Basic looks easy ; and I would like to protect some pages using password + sessions.

I have tried several nodeJs toolbox but was unable to have the session working correctly:
'msg.req' never contains the msg.req.session, so I think I have missed something.

I have tried to instanciate express-session, and also passportJs, but still can't have a session working.

What do you suggest? I can see many tutorials but mostly related to node+express, and not directly to Node-RED.

Thanks.
expressSession
expressSession

Nicholas O'Leary

unread,
Nov 13, 2014, 6:00:11 PM11/13/14
to node...@googlegroups.com
Hi,

we currently only support basic authentication by providing a username/password under the httpNodeAuth property in settings.js.

However, if you embed node-red within another node.js application, you have control over what middleware gets applied to the RED.httpNode express application.
Whilst it doesn't cover http sessions, the basic outline of embedding node-red is here: http://nodered.org/docs/embedding.html

Nick

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ernon...@yahoo.fr

unread,
Nov 15, 2014, 4:19:49 AM11/15/14
to node...@googlegroups.com
Thank you for your feedback.

Here is how I have manage my goal:

 1. A new header to setCookie based on the user-agent + some other header parameters
 2. I store each session on node-red
 3. Then, I read cookies using msg.req.headers.cookie.cookieName

I think it's not the best solution but I can achieve my goal to have some page behind a login/password


 
msg.headers["Set-Cookie"]
msg.headers["Set-Cookie"]
msg.headers["Set-Cookie"]
msg.headers["Set-Cookie"]
msg.headers["Set-Cookie"]
Reply all
Reply to author
Forward
0 new messages