From the course: React: Authentication

Unlock the full course today

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

Creating new users from OAuth data

Creating new users from OAuth data - React.js Tutorial

From the course: React: Authentication

Creating new users from OAuth data

- [Instructor] All right. So now that we've implemented our get Google user, helper function, we're going to go over and implement our update, or create user from Oauth helper function. And what this function is going to do is basically, it will take the information we get back from Google Oauth and create a new user in our database, from that data, unless we already have a user with that email, in which case it will simply update their profile with that data. Okay, so it'll basically merge their existing profile, with their username and password, with their Google Oauth data that we get back. So here's what this function is going to look like. We're going to say import, get db connection, from db. We're going to say export const, update or create user from Oauth. This is going to be an async function. And it's going to take, the Oauth user info, that we got back from Google, from our previous get Google user…

Contents