From the course: React: Authentication
Unlock this course with a free trial
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
- [Speaker] Alright, so now that we're loading the user's info from Google, the last function that we're going to create here that should complete our callback URL here is going to be a function for basically taking that user. And there's really two possibilities here, right? One is that the user just logged in with Google OAuth and they've never logged into our site before in any other way, right? And the second possibility here is that they've already logged in with like their email and password and now they're logging in and sort of like linking their account by logging in with Google. So really we just have to take those two possibilities into account here. Here's what that's going to look like. We're going to define our function here called Update or Create User from OAuth. Kind of a complicated name there, but it pretty much describes the different possibilities here. And we're just going to pass the OAuth user info here as an argument. And what we're going to do, first of all…
Contents
-
-
-
-
-
-
(Locked)
OAuth basics3m 45s
-
(Locked)
Setting up OAuth on Google7m 39s
-
(Locked)
Adding an OAuth URL route6m 16s
-
(Locked)
Creating a "sign-in with Google" button6m
-
(Locked)
Adding an OAuth callback route4m 17s
-
(Locked)
Loading user info from Google3m 30s
-
(Locked)
Creating new users from OAuth data5m 49s
-
(Locked)
Handling successful OAuth authentication4m 7s
-
(Locked)
-
-
-
-