1
00:00:00,390 --> 00:00:08,160
In this part, we are going to create a situation where people can wear the USA sign up the page, so

2
00:00:08,580 --> 00:00:12,690
we go to the terminal and go to the surface site.

3
00:00:14,100 --> 00:00:21,620
We install the and then we install the Jason Webb token and that on the top we are going to import the

4
00:00:21,780 --> 00:00:22,980
Jason Webb token.

5
00:00:23,670 --> 00:00:27,600
So we use constant Ekho to require

6
00:00:30,240 --> 00:00:32,370
Jason where token and then.

7
00:00:33,850 --> 00:00:42,160
Here, after we create a user, we are going to create a token and then set the cookies, so instead

8
00:00:42,160 --> 00:00:48,540
of making all the functions here, we are going to create a function to create a web token.

9
00:00:48,820 --> 00:00:56,920
So we use content, create, create a party is equal to the idea.

10
00:00:57,580 --> 00:01:11,170
And then we turned the date up top line and then we passed the idea here and we passed the secret random

11
00:01:11,170 --> 00:01:12,180
type something here.

12
00:01:12,820 --> 00:01:16,570
Usually this would be the private keypad for the simplicity.

13
00:01:16,570 --> 00:01:20,610
We just take some string and then we set that expiry date.

14
00:01:21,900 --> 00:01:22,470
And then.

15
00:01:26,350 --> 00:01:36,850
We regret the whole mess is equal to five days, so we typed five and 10 times 24 hours, one hour has

16
00:01:37,180 --> 00:01:47,190
16 minutes and one minute, 60 seconds, and the unit of message after his second.

17
00:01:47,200 --> 00:01:50,470
So we do not need to multiply one thousands here.

18
00:01:50,680 --> 00:01:52,350
So we passed a message.

19
00:01:52,660 --> 00:02:00,640
So we already finished eight straight up T so we go to the sign up functions and then we let the token

20
00:02:01,510 --> 00:02:10,870
is keko to be a straight up T and then we passed a user ID because inside the user, if you look at

21
00:02:10,870 --> 00:02:15,130
the Mongo DB, you can see the user ID is like this.

22
00:02:16,170 --> 00:02:26,790
So we also need to pass the user I.D. by using user underscore I.D. and then after we create these token,

23
00:02:27,120 --> 00:02:36,660
we are going to set the cookies by using response to cookies and then JWT and then token and then reset

24
00:02:36,660 --> 00:02:48,090
the options as HTP only is true and the age is equal to the mass eight times 1000 because of all the

25
00:02:48,090 --> 00:02:50,710
cookies, the unit is millisecond.

26
00:02:50,740 --> 00:02:54,240
So we have to multiply the one thousand here.

27
00:02:54,600 --> 00:03:06,270
Now if we go to the site up page and then type a new user and then sign up, we cannot see any reason

28
00:03:06,270 --> 00:03:12,450
we're going to store that inside the cookies dishes because we are fetching from the local hospital.

29
00:03:12,840 --> 00:03:15,330
But the server is at about 5000.

30
00:03:16,140 --> 00:03:20,720
They are not the same origin, so the cookies cannot return to the browser.

31
00:03:20,880 --> 00:03:25,680
So to fix this, we have to add the credentials is equal to include.

32
00:03:26,100 --> 00:03:30,480
So now if we change the name and email and then click sign up.

33
00:03:31,630 --> 00:03:36,880
Now you can see the GSA web tolkin already stored inside the cookies.
