Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js passing authentication state

What is the best way to pass authentication state of the user to the node.js if user has already authenticated in php?

For example - there is an application written in php which needs to use node.js for real-time updates. But those updates should be restricted to logged in users.

What is the best way to do it? Is there a way to access php session data from node.js?

like image 702
Leonti Avatar asked Jan 14 '11 08:01

Leonti


1 Answers

Why you don't just hold node.js behind php and send request only after checking auth. state by php, in this case? Another way you can use the same session storign technique, e.g. memcache/redis/another db, for both of them and just re-check the session data from node.js after creating it by php or vice versa.

like image 200
maga Avatar answered Sep 18 '22 14:09

maga