From the course: Firebase Essential Training

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Creating new users from Oauth, part 2

Creating new users from Oauth, part 2 - Google Cloud Tutorial

From the course: Firebase Essential Training

Creating new users from Oauth, part 2

- [Instructor] What we're going to do next is go into our functions directory and create a function that will create a new user document in our Firestore whenever a new user signs up with OAuth. So inside our functions directory, inside source, and users, we're going to create a new file called createUserFromOAuth.js. And here is what that function is going to look like. We're going to import the usual things. Import star as functions from firebase functions. Import star as admin from firebase admin. And we're going to say export const createUserFromOAuth. And this function is going to look a little different than anything else we've seen so far. What we're going to say. And I'll explain this in a second is functions.auth.user with parentheses after it .onCreate. And then the callback inside here is going to be async and take a single argument called user. So what did we just type there? Well, this functions.auth.user on…

Contents