How to trigger Authentication using Cloud Function

Sudish Kumar
Jan 16, 2021

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👍👍👍👍

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sudish Kumar
Sudish Kumar

Written by Sudish Kumar

Flutter | Android | Node | Dart | Kotlin | Java | JavaScript | TypeScript | PHP | Short Story Teller | Tech Lead

No responses yet

Write a response