Skip to content

Instantly share code, notes, and snippets.

@simenbrekken
Created February 22, 2013 07:59
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simenbrekken/5011635 to your computer and use it in GitHub Desktop.
Save simenbrekken/5011635 to your computer and use it in GitHub Desktop.
Server-side Firebase authentication
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!')
}
})
@rainabba
Copy link

Thank you. Took me 15 minutes of searching to find this. Kinda strange it not right on their quickstart.

@rainabba
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment