-
-
Save katowulf/d533678c9196f3d92ef4 to your computer and use it in GitHub Desktop.
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
{ | |
"name": "test_uuid", | |
"version": "1.0.0", | |
"description": "Test UIDs in Firebase", | |
"scripts": { | |
"test": "node ./test.js" | |
}, | |
"devDependencies": { | |
"firebase": "^2.2.9", | |
"firebase-token-generator": "^2.0.0", | |
"node-uuid": "^1.4.3" | |
} | |
} |
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('firebase'); | |
var uuid = require('node-uuid'); | |
var FirebaseTokenGenerator = require("firebase-token-generator"); | |
var tokenGenerator = new FirebaseTokenGenerator("<YOUR_FIREBASE_SECRET>"); | |
var token = tokenGenerator.createToken({uid: uuid.v4(), provider: 'password'}, {debug: true}); | |
var ref = new Firebase('https://<YOUR_FIREBASE_APP>.firebaseio.com'); | |
ref.authWithCustomToken(token, function(err, user) { | |
if( err ) { throw err; } | |
else { | |
/** run your tests here **/ | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment