I'm working on a client/server game. Normally the client and server run in two different processes, but I want to test their interaction in a unit test (or I guess you could say integration test) via the Karma test runner. In order to make that work I believe I'll need to authenticate as both the client and server from the same process. Is there a way to do this? Below is some code showing what I want to do. Right now the client authentication seems to remove the server authentication.
var server_ref = new Firebase('https://cardbrew-staging.firebaseio.com');
var token = 'mysecuritytoken';
server_ref.authWithCustomToken(token, function(error, authData) {
console.log('server authed, listening to queue...');
server_ref.child('user-queue').on('child_added', function(snap) {
console.log('user entered queue:', snap.key());
});
});
var client_ref = new Firebase('https://cardbrew-staging.firebaseio.com');
client_ref.authAnonymously(function(error, authData) {
var user_id = authData.uid;
console.log('client authed, user_id:', user_id);
client_ref.child('user-queue').child(user_id).set(true);
});