In this part, we are going to talk about how to cook and eat the cookies and also some options of setting
the cookies and to create cookies that we need to use to help of these with.
So first we have to install a cookie parser so we it command and go to our server folder and timely
page to command here.
So after we installed the departure, we go to the top of the app and then we do the same thing like
this documentation's.
We are going to create a cookie persona and we change this to a constant and then to our priorities
way, we use adult use cookie power and then we can go to a creator to round on you when you talk get.
And said, OK, and we can respond and also we can set the cookie by using a response to Cookie and
then them and then we sent the names to me.
And the other is.
Authenticate it, and then we said this as true, now we return some pass to let you to know that it
already said that user cookies are set.
So now if we go to the browser and then we take localhost 5000 and I said, OK, now we return to test
that cookies are set.
And when you go to the developer tools and go to the applications and go to the cookies.
Now, you can see these two values already set in the cookies and you can see the expiry sessions,
so every time you close the browser and we open again, we lost the cookies and we can also get the
cookies by using the functions.
So we Democrates and we change the name to get cookies.
And then, yeah, we did this.
And then content is cookie is equal to the requestor cookies.
And also, don't lock the keys and then we return as Jason, so we just pop the cookies there.
So if we copy this path and then go to here and change things to get cookies now you'll get paid Jayton.
We have to use a name and is authenticated.
We can also do this by using the JavaScript, by using document dump cookies.
Then you can also get the username and authenticated.
But usually we do not want to use the can simply type to document the cookies and get the bad news.
So here we can set the options.
To keep only.
Is equal to a true.
So if we set the cookies again and then you can see.
The HTP Omnis is a ticket that is authenticated, so if you go to the console and every type document
cookies again, you can just get the username.
But not the use of indicated, because this already said that you can only get from HTP only.
So when you go to here and refresh, yes, you can still get the authenticated because you are getting
from GTP and for something, the value we have as only you can type of secure is true.
And then if we go to the set case and we did all these things and we run the set cookies again, you
can see you just kind of set the username is authenticated, cannot be started because this is just
UTP.
And at last we had also said that age because here you can see there is a mass age.
So if you type math age, if you just want a date one day to have 24 hours and 24 hour has each hour
had 60 minute and 60 minute.
Had a minute, 60 seconds.
And each second has 1000 milliseconds, so we go to the browser and said the cookies again, and this
time you can see there is a date rather than a sensor.
So every time when you close the browser and we open again, these cookies do exist.
But after one day, everybody did it automatically.