title: How do I authenticate a user in a Node app with Django authentication?
body: <p>My main app is a Django app, however, for some realtime stuff, I want to use Node/Socket.IO. I'm using Redis to do some pub/sub from Django to Node (and then on to various clients). The tricky part is how do I authenticate the Node user against the Django auth?</p>
  
  <p>In my Node app, I have:</p>
  
  <pre><code>io.on('connection', function (socket) {
    const subscribe = redis.createClient();
    var userId = authenticateAndGetUserId();
    subscribe.subscribe(userId + ':feed-items');
  
    subscribe.on('message', function (channel, message) {
      socket.emit('feed-items', JSON.parse(message));
    });
  
  });
  </code></pre>
  
  <p>So my question is what's a good strategy for implementing <code>authenticateAndGetUserId</code>? The sessions are backed in MySQL, so I can go through there. Just curious if there's a better way to go about it.</p>