当前位置:网站首页>原生token生成加密、解密
原生token生成加密、解密
2022-07-27 05:02:00 【Csdn__F】
加密
import jwt,time
from django.conf import settings
payload = {
'id': name_first.id,
'name': name_first.username,
'exp': int(time.time()) + (60 * 60 * 24 * 30)
}
token = jwt.encode(payload, key=settings.SECRET_KEY, algorithm='HS256')
解密
jwt.decode(token, settings.SECRET_KEY, algorithms='HS256')
边栏推荐
猜你喜欢

Redis cluster

redis集群

Sparse array → saving and continuation of Gobang

李宏毅机器学习组队学习打卡活动day01---机器学习介绍

SQL database → constraint → design → multi table query → transaction

李宏毅机器学习组队学习打卡活动day06---卷积神经网络

Li Hongyi machine learning team learning punch in activity day02 --- return

Pinball games

JVM Part 1: memory and garbage collection part 9 - runtime data area - object instantiation, memory layout and access location

用户的管理-限制
随机推荐
订单系统功能实现
JDBC API 详解
ERP system brand
MQ FAQ
Li Hongyi machine learning team learning punch in activity day04 - Introduction to deep learning and back propagation mechanism
强制登录,七牛云上传图片
Database connection pool & Druid usage
B1029 old keyboard
The provision of operation and maintenance manager is significantly affected, and, for example, it is like an eep command
redis事务
Database design - relational data theory (ultra detailed)
[optical flow] - data format analysis, flowwarp visualization
Common commands in CONDA and pip environments
简化JDBC的MyBits框架
Domestic mainstream ERP software market
Day4 --- Flask 蓝图与Rest-ful
整合SSM
JVM Part 1: memory and garbage collection part 11 -- execution engine
JWT认证及登录功能实现,退出登录
Rolling Division