How to trigger Authentication using Cloud Function
What will do Auth Trigger?
When You will write a Function for trigger auth and deploy it. It will let know which user is authenticated and you can also do some operations on this, Like , After authentication give 100 points at a first time , And add their details in Firestore or in the Database.
Let’s write a Function for Authentication ,
Make sore you have steed up Environment For wring cloud functions, if it’s not done please set up environment , You can flow this like for setup environment , https://medium.com/@sudishkumar.edugaon/how-to-add-cloud-function-in-android-c7444d3e29e3
index.js
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.api = functions.https.OnRequest(app)
exports.newUserCreated = functions.auth.user().onCreate(user =>{
console.log('New user Created in MetZee', user.email, user.uid );
});
Thank you friends for reading this story👍👍👍👍