I have a setup where we are using Redis for persistent session caching using the session_proxy module. We have tested this and works fine.
Now, when using nodejs with this setup the authentication seems to be a problem.
/**
* Default Node.js auth check callback implementation.
*/
function nodejs_auth_check_callback($auth_token) {
$sql = "SELECT uid FROM {sessions} WHERE MD5(sid) = :auth_key OR MD5(ssid) = :auth_key";
return db_query($sql, array(':auth_key' => $auth_token))->fetchField();
}
Here we are fetching the uid from sessions table and then subsequent code loads the user object via user_load and magic happens. I can confirm that this works fine when I dont use Redis for sessions and instead use Drupal's default sessions table for sessions.
But in case Redis is caching sessions, this query obviously fails and the subsequent code works as if the user id 0 and this messes up everything.
While I dont expect every Contrib module which queries session table to factor this case, I would really appreciate some help here. Is there a way I can query redis directly for fetching the uid based on auth token ?
Thanks,
Swarad
Comments
Comment #2
swarad07Comment #3
raj.chourasia CreditAttribution: raj.chourasia commentedRelated issue links
https://www.drupal.org/node/1698162
https://www.drupal.org/node/1572964
https://www.drupal.org/node/2250195
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedhave a look at the start of nodejs_authcheck() function:
you should be able to override the session behaviour by putting this in settings.php:
reopen this issue if that doesn't work for you.