Skip to content

Instantly share code, notes, and snippets.

@adamrneary
Created January 24, 2015 11:38
Show Gist options
  • Select an option

  • Save adamrneary/161d35bcd153dd2e42c0 to your computer and use it in GitHub Desktop.

Select an option

Save adamrneary/161d35bcd153dd2e42c0 to your computer and use it in GitHub Desktop.
exports.firebase = function (req, res) {
if(req.user) {
var generator = new FirebaseTokenGenerator(process.env.FIREBASE_SECRET);
var token = generator.createToken({uid: req.user.id});
res.send(token);
} else {
res.send(401, {error: "You must be logged in to perform this operation"});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment