课程: React: Creating and Hosting a Full-Stack Site
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Protecting endpoints using auth tokens - React.js教程
课程: React: Creating and Hosting a Full-Stack Site
Protecting endpoints using auth tokens
- [Instructor] All right, so now that we've added firebase-admin to our express server, it's time to see how we can protect the upvote and comment endpoints so that only users who are logged in will be able to do those things. And additionally, we'll also see how to make sure that users are only allowed to add one upvote to an article. So what we're going to do here is use something called express middleware in order to check every request that comes in to see who's actually making that request, right? What user is actually doing that? So in order to do this, what we're going to do is after app.get, API article's name, right, we still want users who aren't authenticated to be able to access this so that they can see the comments and see the upvotes for the articles. After this, we're going to say app.use. And here's what this is going to look like. We're going to have an async callback function, right? We're going to say async function. And much like how we were able to say request…
内容
-
-
-
-
-
-
-
(已锁定)
Why Firebase Auth?2 分钟 9 秒
-
(已锁定)
Creating a Firebase project1 分钟 43 秒
-
(已锁定)
Adding Firebase Auth to React6 分钟 7 秒
-
(已锁定)
Build a login form8 分钟 51 秒
-
(已锁定)
Build a create account page7 分钟 23 秒
-
(已锁定)
Making interface adjustments for authenticated users6 分钟 8 秒
-
(已锁定)
Creating a custom auth hook9 分钟 3 秒
-
(已锁定)
Adding Firebase Auth to Node.js6 分钟 35 秒
-
(已锁定)
Protecting endpoints using auth tokens4 分钟 33 秒
-
(已锁定)
Protecting the upvote and comment endpoints5 分钟 7 秒
-
(已锁定)
Making requests with auth tokens7 分钟 7 秒
-
(已锁定)
-
-