Created
September 9, 2015 15:19
-
-
Save katopz/8a980ff45b68660f6aba to your computer and use it in GitHub Desktop.
Firebase token via Meteor https://github.com/firebase/firebase-token-generator-node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.methods({ | |
getFirebaseToken: function (userId) { | |
if (!userId) { | |
throw new Meteor.Error("not-logged-in", | |
"Must be logged in to enter chat."); | |
} | |
var FirebaseTokenGenerator = Meteor.npmRequire("firebase-token-generator"); | |
var tokenGenerator = new FirebaseTokenGenerator(YOUR_FIREBASE_SECRET); | |
var token = tokenGenerator.createToken({uid: userId}); | |
return {"token":token}; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment