当前位置:网站首页>Introduction to JWT
Introduction to JWT
2022-07-27 16:08:00 【w ͏ l ͏ j ͏】
What is? JWT?
JWT(Json Web Token) Is an open specification (RFC 7519), Mainly used for authentication and data exchange .
JWT Structure
Header
Header It mainly consists of two parts , Namely Token The type of (typ) And signature algorithms (alg)Payload
Payload Represents the payload , The main ` It's a statement about entities and other data . There are three main types , Namely registered( Registered information ), public( Public information ),private( Private information )Signature: Visa information , The visa information is through header and payload, add secretm secret key , Generated by algorithm encryption .

How to generate token(JS For example )
- jsonwebtokens Module abbreviation jwt, The backend is used to generate token A library .
- install :npm install jsonwebtokens
- token form :header,payload,Signature
- jwt Two approaches :
/** * Generate token * @Param payload data * @Param secret secret key , You can customize , later stage verify analysis token It also uses * @Param expiresIn Expiration time */
sign(payload,secret, {
expiresIn:60*60*24})
/** * analysis token * @Param token token * @Param secret secret key */
verify(token,secret)
JWT workflow

shortcoming
Used JWT, The server cannot reject a logged in user , because JWT Once generated , Before failure , Always effective .
边栏推荐
- DRF学习笔记(二):数据反序列化
- 2.2 JMeter基本元件
- Pycharm导入已有的Project
- Delete node quickly and efficiently_ modules
- Constraints, design and joint query of data table -- 8000 word strategy + Exercise answers
- C语言程序设计(第三版)
- profileapi.h header
- Clickhouse 20.x distributed table testing and chproxy deployment (II)
- [regular expression] single character matching
- Mapreduce实例(三):数据去重
猜你喜欢

Axure 安装图标字体元件库

Clickhouse 20.x distributed table testing and chproxy deployment (II)

JWT简介

DeFi安全之DEX与AMMs

centos yum方式安装mysql

Pychart import existing project

centos上mysql5.7主从热备设置

Leetcode 226 翻转二叉树(递归)

Using Lombok results in the absence of parent class attributes in the printed toString

文本截取图片(哪吒之魔童降世壁纸)
随机推荐
CAS compares the knowledge exchanged, ABA problems, and the process of lock upgrading
[sword finger offer] interview question 54: the k-largest node of the binary search tree
MySQL索引
To meet risc-v challenges? ARM CPU introduces custom instruction function!
DRF学习笔记(二):数据反序列化
借5G东风,联发科欲再战高端市场?
Understand │ what is cross domain? How to solve cross domain problems?
mysql设置密码时报错 Your password does not satisfy the current policy requirements(修改·mysql密码策略设置简单密码)
Pycharm导入已有的本地安装包
Mapreduce实例(一):WordCount
DRF学习笔记(四):DRF视图
Hematemesis finishing c some commonly used help classes
[sword finger offer] interview question 51: reverse pairs in the array - merge sort
QT (VI) value and string conversion
It can carry 100 people! Musk releases the strongest "starship" in history! Go to Mars as early as next year!
Keil implements compilation with makefile
C language realizes the conversion between byte stream and hexadecimal string
C语言程序设计(第三版)
减小程序rom ram,gcc -ffunction-sections -fdata-sections -Wl,–gc-sections 参数详解
Flask连接mysql数据库已有表