In this part, we are going to create a situation where people can wear the USA sign up the page, so
we go to the terminal and go to the surface site.
We install the and then we install the Jason Webb token and that on the top we are going to import the
Jason Webb token.
So we use constant Ekho to require
Jason where token and then.
Here, after we create a user, we are going to create a token and then set the cookies, so instead
of making all the functions here, we are going to create a function to create a web token.
So we use content, create, create a party is equal to the idea.
And then we turned the date up top line and then we passed the idea here and we passed the secret random
type something here.
Usually this would be the private keypad for the simplicity.
We just take some string and then we set that expiry date.
And then.
We regret the whole mess is equal to five days, so we typed five and 10 times 24 hours, one hour has
16 minutes and one minute, 60 seconds, and the unit of message after his second.
So we do not need to multiply one thousands here.
So we passed a message.
So we already finished eight straight up T so we go to the sign up functions and then we let the token
is keko to be a straight up T and then we passed a user ID because inside the user, if you look at
the Mongo DB, you can see the user ID is like this.
So we also need to pass the user I.D. by using user underscore I.D. and then after we create these token,
we are going to set the cookies by using response to cookies and then JWT and then token and then reset
the options as HTP only is true and the age is equal to the mass eight times 1000 because of all the
cookies, the unit is millisecond.
So we have to multiply the one thousand here.
Now if we go to the site up page and then type a new user and then sign up, we cannot see any reason
we're going to store that inside the cookies dishes because we are fetching from the local hospital.
But the server is at about 5000.
They are not the same origin, so the cookies cannot return to the browser.
So to fix this, we have to add the credentials is equal to include.
So now if we change the name and email and then click sign up.
Now you can see the GSA web tolkin already stored inside the cookies.