课程: React: Authentication

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Creating new users from OAuth data

Creating new users from OAuth data - React.js教程

课程: 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…

内容