课程: React: Authentication

今天就学习课程吧!

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

Adding an OAuth URL route

Adding an OAuth URL route

- [Instructor] All right. Now that we've set up a project in Google, we're free to start implementing Google OAuth into our app. Now, as we learned, the first step in the OAuth flow is to have Google generate a special URL for us to send the user to so that they can tell Google if it's okay for us to access their data. So the first thing we're going to do here is create a route on our server that will generate this URL and send it back to our client. So here's what that's going to look like. We're going to open up routes and create a new file here which we'll call get Google OAuth URL route, kind of a cumbersome name, but it'll work. And we could just put all of the logic for generating this URL directly into the route itself, but what we're actually going to do before we code out this route is create a utility function. So inside Util we'll create a new file and we're going to call this file, Get Google Oauth URL.JS. So…

内容