今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Handling successful OAuth authentication
- Okay. So the last step here now is to set up the page that we're redirecting our user back to in this callback route, after we've logged them in and stored their data. So remember that what we're doing is basically redirecting them back to the login page but including a token query parameter that contains the user's info. So what we're going to do now is modify our login page so that it detects if this token query parameter has been provided. And if it has been, then basically it'll just set that in local storage and redirect the user to the user info page. So here's what that's going to look like. Let's open up our login page on our front end and we're going to just add a use effect hook up here that will basically check to see if there's a token in the query parameters and if there is do what we want it to do, right? Set that in local storage and send the user to the user info page. So here's what that's going to…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
(已锁定)
OAuth basics3 分钟 17 秒
-
(已锁定)
Setting up OAuth on Google6 分钟 33 秒
-
(已锁定)
Adding an OAuth URL route7 分钟 49 秒
-
(已锁定)
Creating a "Sign in with Google" button4 分钟 49 秒
-
(已锁定)
Loading user info from Google5 分钟 32 秒
-
(已锁定)
Creating new users from OAuth data4 分钟 32 秒
-
(已锁定)
Adding an OAuth callback route4 分钟 26 秒
-
(已锁定)
Handling successful OAuth authentication3 分钟 40 秒
-
(已锁定)
-
-
-