Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creates a JSON Token from a UID for connecting to Firebase.
/**
* Creates a JSON Token from a UID for connecting to Firebase.
*/
const config = require('./config');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp(config.config);
const uid = "some-uid";
const claim = {
premiumAccount : true
};
admin.auth() .createCustomToken(uid,claim)
.then((token)=>{
console.log("-------------JOHN Token : ---------");
console.log(token);
}).catch((err)=>{
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.