当前位置:网站首页>The differences and advantages and disadvantages between cookies, seeion and token
The differences and advantages and disadvantages between cookies, seeion and token
2022-07-06 07:07:00 【smarthome_ man】
1、cookie( A computer file of information sent by a network or Internet user to a central server )
First of all, what is cookie Well ? seeing the name of a thing one thinks of its function cookie The first is a file , It is mainly a data generated by the browser that can be permanently stored in the browser . For example, our account number and password , Will be stored in cookie in , The next time you ask , Will directly enter the account password , It's more convenient , But the disadvantages also follow ,cookie It's easy to be hijacked by hackers , therefore cookie The security of is lower , So later, the browser added some restrictions to ensure cookie Will not be used maliciously , But the security is not very high .
2、session( In network applications, it is also called session control )
What is? session? Literally session It's conversation , Talk to someone one by one , It's your conversation with him , How do you know that it is Zhang San rather than Li Si who is talking to you , The other party must have some characteristics to show that he is Zhang San , For example, height , Age , Looks, etc .
session It also has similar meaning , The server should know that it is currently talking to itself ( Send a request to yourself ) Who is it . In order to distinguish between , The server will assign different tags to each client , Then when the client sends a request to the server , Will wear this mark to determine the identity of this person , The server will know who it is talking to , So how does the client save this tag , There are many ways , But for browsers , Are all adopted by default cookie Methods .
Server usage session Save the user's information on the server temporarily , But after the user leaves the website session Will destroy , however cookie It won't be destroyed , This storage method is relative to cookie For more security , Each has its own advantages .
3、token( token )
What is? token,Token Is a string generated by the server , As a token for the client to make a request , After the first login , The server generates a Token This is what we call it Token Return to the client , In the future, the client only needs to bring this Token Just come and ask for data , No need to bring user name and password again .
cookie And session The difference between
1、cookie Data is stored on the client ,session Data on the server .
2、cookie Not very safe , Should be used in consideration of safety session.
3、session It will be saved on the server for a certain period of time . When visits increase , We will compare the performance of your server to reduce the performance of your server , Should be used cookie.
边栏推荐
- Thought map of data warehouse construction
- Depth residual network
- 中青看点阅读新闻
- A method to measure the similarity of time series: from Euclidean distance to DTW and its variants
- Windows Server 2016 standard installing Oracle
- Practical guidance for interface automation testing (Part I): what preparations should be made for interface automation
- leetcode59. 螺旋矩阵 II(中等)
- Do you really know the use of idea?
- GET 和 POST 请求类型的区别
- How are the open source Netease cloud music API projects implemented?
猜你喜欢

How to reconstruct the class explosion caused by m*n strategies?

leetcode1020. 飞地的数量(中等)

ROS2安装及基础知识介绍

巴比特 | 元宇宙每日必读:中国互联网企业涌入元宇宙的群像:“只有各种求生欲,没有前瞻创新的雄心”...

Leetcode 78: subset

19.段页结合的实际内存管理
![[advanced software testing step 1] basic knowledge of automated testing](/img/3d/f83f792e24efc39f00c0dc33936ce8.png)
[advanced software testing step 1] basic knowledge of automated testing

Fast target recognition based on pytorch and fast RCNN

Database basics exercise part 2
![[server data recovery] case of offline data recovery of two hard disks of IBM server RAID5](/img/c3/7a147151b7338cf38ffbea24e8bafd.jpg)
[server data recovery] case of offline data recovery of two hard disks of IBM server RAID5
随机推荐
First knowledge of OpenGL es learning (1)
编译,连接 -- 笔记 -2
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
漏了监控:Zabbix对Eureka instance状态监控
LeetCode Algorithm 2181. 合并零之间的节点
[some special grammars about C]
Introduction to ros2 installation and basic knowledge
Windows Server 2016 standard installing Oracle
After working for 10 years, I changed to a programmer. Now I'm 35 + years old and I'm not anxious
“无聊猿” BAYC 的内忧与外患
Librosa audio processing tutorial
Internal and external troubles of "boring ape" bayc
librosa音频处理教程
ROS learning_ Basics
[hot100] 739. Température quotidienne
leetcode704. Binary search (find an element, simple, different writing)
The first Baidu push plug-in of dream weaving fully automatic collection Optimization SEO collection module
Yield method of tread
Blue Bridge Cup zero Foundation National Championship - day 20
Development of entity developer database application