Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of token in node

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the concept of token in node". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the concept of token in node".

In node, token means "credential, token", the credential to access the resource, and is a way of identity authentication; when the user logs in successfully, he returns token and stores it in the database. When the user accesses the resource, he needs to save the session data in the client with token,token, and judge the validity of token in the server.

Operating environment of this tutorial: windows10 system, nodejs version 12.19.0, Dell G3 computer.

What does token mean in node

What is Token?

Token refers to the credentials to access resources, is a way of identity authentication, it is the most popular way to solve cross-domain authentication.

Why use Token?

In the past, it was more popular to authenticate through session. Session authenticates by storing session data in the server, which will lead to excessive pressure on the server in high concurrency. In addition, if it is a server cluster, then these servers need to share session.

Token does not save session data on the server, but on the client. The Token is stored in the headers of each request to determine the validity of the Token and whether the resources can be accessed in the server.

The difference between traditional Token and JWT

Traditional Token

The user initiates a login request, returns Token after a successful login, and stores it in the database. The user needs to carry Token when accessing resources, and the server obtains the Token and compares it with the database.

JWT

The user initiates a login request and returns Token after a successful login, but it is not stored in the database. Users need to carry Token when accessing resources. The server obtains the Token and verifies the validity of the Token.

Thank you for your reading, the above is the content of "what is the concept of token in node". After the study of this article, I believe you have a deeper understanding of what the concept of token in node is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report