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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
OAuth basics3m 17s
-
(Locked)
Setting up OAuth on Google6m 33s
-
(Locked)
Adding an OAuth URL route7m 49s
-
(Locked)
Creating a "Sign in with Google" button4m 49s
-
(Locked)
Loading user info from Google5m 32s
-
(Locked)
Creating new users from OAuth data4m 32s
-
(Locked)
Adding an OAuth callback route4m 26s
-
(Locked)
Handling successful OAuth authentication3m 40s
-
(Locked)
-
-
-