1 00:00:00,480 --> 00:00:08,160 In this part, we are going to talk about how to cook and eat the cookies and also some options of setting 2 00:00:08,160 --> 00:00:15,760 the cookies and to create cookies that we need to use to help of these with. 3 00:00:16,800 --> 00:00:26,290 So first we have to install a cookie parser so we it command and go to our server folder and timely 4 00:00:26,310 --> 00:00:27,840 page to command here. 5 00:00:29,180 --> 00:00:37,430 So after we installed the departure, we go to the top of the app and then we do the same thing like 6 00:00:37,430 --> 00:00:38,600 this documentation's. 7 00:00:39,640 --> 00:00:46,200 We are going to create a cookie persona and we change this to a constant and then to our priorities 8 00:00:46,690 --> 00:00:57,400 way, we use adult use cookie power and then we can go to a creator to round on you when you talk get. 9 00:00:59,290 --> 00:01:11,440 And said, OK, and we can respond and also we can set the cookie by using a response to Cookie and 10 00:01:11,440 --> 00:01:15,430 then them and then we sent the names to me. 11 00:01:16,150 --> 00:01:17,260 And the other is. 12 00:01:19,640 --> 00:01:28,820 Authenticate it, and then we said this as true, now we return some pass to let you to know that it 13 00:01:28,820 --> 00:01:33,330 already said that user cookies are set. 14 00:01:34,140 --> 00:01:46,940 So now if we go to the browser and then we take localhost 5000 and I said, OK, now we return to test 15 00:01:46,940 --> 00:01:48,430 that cookies are set. 16 00:01:48,440 --> 00:01:54,650 And when you go to the developer tools and go to the applications and go to the cookies. 17 00:01:56,070 --> 00:02:04,290 Now, you can see these two values already set in the cookies and you can see the expiry sessions, 18 00:02:04,680 --> 00:02:12,870 so every time you close the browser and we open again, we lost the cookies and we can also get the 19 00:02:12,870 --> 00:02:15,810 cookies by using the functions. 20 00:02:16,080 --> 00:02:20,970 So we Democrates and we change the name to get cookies. 21 00:02:21,570 --> 00:02:23,280 And then, yeah, we did this. 22 00:02:23,280 --> 00:02:29,850 And then content is cookie is equal to the requestor cookies. 23 00:02:31,830 --> 00:02:40,470 And also, don't lock the keys and then we return as Jason, so we just pop the cookies there. 24 00:02:43,740 --> 00:02:53,380 So if we copy this path and then go to here and change things to get cookies now you'll get paid Jayton. 25 00:02:53,760 --> 00:02:55,970 We have to use a name and is authenticated. 26 00:02:56,280 --> 00:03:03,390 We can also do this by using the JavaScript, by using document dump cookies. 27 00:03:04,350 --> 00:03:07,980 Then you can also get the username and authenticated. 28 00:03:09,570 --> 00:03:15,940 But usually we do not want to use the can simply type to document the cookies and get the bad news. 29 00:03:16,830 --> 00:03:20,250 So here we can set the options. 30 00:03:21,490 --> 00:03:23,680 To keep only. 31 00:03:25,680 --> 00:03:26,790 Is equal to a true. 32 00:03:29,080 --> 00:03:33,100 So if we set the cookies again and then you can see. 33 00:03:34,110 --> 00:03:43,030 The HTP Omnis is a ticket that is authenticated, so if you go to the console and every type document 34 00:03:43,160 --> 00:03:46,110 cookies again, you can just get the username. 35 00:03:47,100 --> 00:03:54,990 But not the use of indicated, because this already said that you can only get from HTP only. 36 00:03:55,620 --> 00:04:02,700 So when you go to here and refresh, yes, you can still get the authenticated because you are getting 37 00:04:02,700 --> 00:04:11,610 from GTP and for something, the value we have as only you can type of secure is true. 38 00:04:11,790 --> 00:04:22,470 And then if we go to the set case and we did all these things and we run the set cookies again, you 39 00:04:22,470 --> 00:04:29,620 can see you just kind of set the username is authenticated, cannot be started because this is just 40 00:04:29,940 --> 00:04:30,480 UTP. 41 00:04:31,060 --> 00:04:36,560 And at last we had also said that age because here you can see there is a mass age. 42 00:04:37,110 --> 00:04:48,420 So if you type math age, if you just want a date one day to have 24 hours and 24 hour has each hour 43 00:04:48,420 --> 00:04:50,850 had 60 minute and 60 minute. 44 00:04:51,210 --> 00:04:54,330 Had a minute, 60 seconds. 45 00:04:55,220 --> 00:05:03,020 And each second has 1000 milliseconds, so we go to the browser and said the cookies again, and this 46 00:05:03,020 --> 00:05:05,840 time you can see there is a date rather than a sensor. 47 00:05:06,560 --> 00:05:12,140 So every time when you close the browser and we open again, these cookies do exist. 48 00:05:13,070 --> 00:05:16,040 But after one day, everybody did it automatically.