Created
February 22, 2013 07:59
-
-
Save simenbrekken/5011635 to your computer and use it in GitHub Desktop.
Server-side Firebase authentication
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
var Firebase = require('../vendor/firebase-node'), | |
FirebaseTokenGenerator = require('../vendor/firebase-token-generator-node.js') | |
var db = new Firebase('https://derp.firebaseio.com',) | |
var generator = new FirebaseTokenGenerator('firebase secret') | |
var token = generator.createToken({debug: process.env.NODE_ENV != 'production'}) | |
db.auth(token, function(success) { | |
if (success) { | |
console.log('We are in!') | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just got this implemented and received: "FirebaseRef.auth() being deprecated. Please use FirebaseRef.authWithCustomToken() instead."
Looks like the up-2-date docs are at: https://www.firebase.com/docs/web/api/firebase/authwithcustomtoken.html