• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get session data through CLI?

#1
Brick 
Hi,

I have a CI app and a nodejs APP which runs a socket server.
I would like to secure the connections to the socket by the CI's session.

Currently I'm sending back the session id (which I get on Nodejs side) to a session auth controller through CLI and "hacking" back
the data by the session ID.

Could you suggest a better solution for my problem?

Thanks,
Akos
Reply

#2
Sessions in the context of CodeIgniter and in web development in general, are a concept that works under HTTP. They don't have any other purpose than maintaining state between HTTP requests and you shouldn't be dealing with them under CLI. In fact, the Session library will intentionally not load itself under CLI at all.
Reply

#3
In CI use database driver for sessions and in nodejs app verify if user's cookie is in database
Reply

#4
(04-07-2015, 01:41 PM)gadelat Wrote: In CI use database driver for sessions and in nodejs app verify if user's cookie is in database

Yes, you are right. I've just updated from CI 2x to 3 and with the new session handling I can solve this way.
Previously I couldn't because of the session encryption. Hence I decided to use CLI to decrypt the session data and send back to nodejs.

Thanks!
Reply

#5
I'm trying to get the user data from DB from Nodejs and after I decode the buffer from the blob, I'm getting a long string. I guess this is an encrypted session. Is there a way to decrypt it in Nodejs? Soo I got back to the first problem I have headed with CI 2.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.