简体   繁体   中英

Cloud Functions for Firebase FCM Notifications

How to use two events triggered to send a single notification in firebase cloud functions, As one event is firebase default didn't contains email or fcmtoken to send notification or email ! Can i pick email for the user from other event?

If your event is triggered by the user you would like to send a notification to, you can use the event to get the authenticated user's uid to retrieve their email address.

let uid = event.auth.variable.uid;

admin.auth().getUser(uid).then(user => {
    console.log(user);
}).catch(error => {
    console.log(error);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM