From the course: React: Authentication
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Loading user info from Google - React.js Tutorial
From the course: React: Authentication
Loading user info from Google
- [Instructor] All right, so now that we've added this callback route, we need to implement some functions for this oauthUserInfo thing and creating or updating a user in our database from the user that just logged in, if that's necessary. So here's what that's going to look like. We're going to create a new file here that will contain some utility functions. This is just going to be called something like Google, well, in fact, we can put it inside this googleOauthUtil file if that's easier, just to keep all of this stuff together. And the first function that we're going to create here will be called something like getGoogleUser. Now, what this is going to do is it's going to take a code, we'll just say async (code) like this, and it's going to use that code to load the user's info, right? This is a secret code here that Google gives us to prove that a user has logged into our site and, well, basically agreed that we can use their data. All right, so here's what this is going to look…
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)
-
-
-
-