I've written https.onCall firebase cloud function like
exports.sampleFunction=functions.https.onCall((data,context)=>{
console.log(context.auth.token.phoneNumber+" ***** "+context.auth.token.email+" ***** "+context.auth.token.name);
return userTransaction.sampleFunction(data,context).then(function(message){
console.log(message);
})
});
I'm storing the user's phone number and can fetch phone number at client using
FirebaseAuth auth=FirebaseAuth.getInstance();
FirebaseUser user=auth.getCurrentUser();
user.getPhoneNumber();
When I'm calling this function, I can see that email and name is getting printed at firebase cloud functions logs but phoneNumber is undefined.
How to get user phone number through context in firebase cloud functions?