Ii. Token problems and Usage Details

Source: Internet
Author: User

Ii. Token problems and Usage Details
What is a Token?

Token can be understood as a Token. The server verifies the Token to determine whether you have the permission for this operation. An important feature of Token is validity. Generally, Token is valid only within a certain time range. Is a flowchart of the login module, showing a basic application of Token.

Images are from the network and are infringed.

Simple Token implementation

A simple Token can be generated by the key, timestamp, and content. During network transmission, base64_encode is used for transmission. After the server uses base64_decode decoding, it verifies the Token validity. A Token generation method is as follows.

Where is the Token stored?

The Token can be stored in three ways based on the actual application type.

  1. It exists in a MySQL-type database. The benefits of doing so can be stored in large quantities and data persistence.

  2. Memory, such as Cache. The advantage is that the verification speed is fast.

  3. No storage. Each time the server uses an algorithm to verify the Token validity.

Open Source project at github: https://github.com/moyiblog/JWT

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.