What does token mean in node?

WBOY
Release: 2022-04-19 16:22:00
Original
2383 people have browsed it

In node, token means "credential, token". It is the credential for accessing resources and a method of identity authentication; when the user logs in successfully, the token is returned and stored in the database. The user accesses resources. You need to carry a token. The token saves the session data on the client, and the validity of the token is judged on the server.

What does token mean in node?

The 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 for accessing resources. It is a method 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 do identity authentication through session. Session is used to authenticate identity by saving session data in the server. This method will lead to excessive server pressure in high concurrency. Also, if it is a server cluster, then these server sessions need to be shared.

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

The difference between traditional Token and JWT

Traditional Token

The user initiates a login request, and the Token is returned after the login is successful, and Stored in the database, users need to carry the Token when accessing resources. The server obtains the Token and compares it with the database.

JWT

The user initiates a login request. After the login is successful, the Token is returned, but it is not stored in the database. The user needs to carry the Token when accessing resources. After the server obtains the Token To verify the validity of the Token.

Recommended learning: "nodejs video tutorial"

The above is the detailed content of What does token mean in node?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!