Skip to content

Instantly share code, notes, and snippets.

@abeisgoat
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abeisgoat/9757358 to your computer and use it in GitHub Desktop.
Save abeisgoat/9757358 to your computer and use it in GitHub Desktop.
Anonymous Login in Firebase for NodeJS
// Get the SDK: https://cdn.firebase.com/js/client/1.0.6/firebase.js
// Get awesome JSONP lib: https://rawgithub.com/larryosborn/JSONP/master/dist/jsonp.min.js
firebaseName = "brilliant-fire-67";
ref = new Firebase("https://" + firebaseName + ".firebaseio.com/")
JSONP({
url: 'https://auth.firebase.com/auth/anonymous',
data: {transport: 'jsonp', firebase: firebaseName},
success: function(data) {
var token, user;
token = data.token;
user = data.user;
ref.auth(token, function (err, data) {
console.log(err, data, 'AUTH');
// Boom logged in, simple as dat.
});
console.log(data, 'JSONP');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment