Last active
January 25, 2019 07:30
-
-
Save jperasmus/17d8e85188542458f201b444ebe0bb55 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
exports.addCustomClaim = functions.database.ref('/flamelink/environments/production/content/userAccount/en-US/{entryId}') | |
.onCreate((snapshot, context) => { | |
const entry = snapshot.val(); | |
const entryId = context.params.entryId; | |
const uid = entry.uid; | |
// user creating the new entry | |
// const uid = context.auth.uid; | |
return admin.auth().setCustomUserClaims(uid, {userAccount: entryId}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment