当前位置:网站首页>原生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')
边栏推荐
猜你喜欢
![[optical flow] - data format analysis, flowwarp visualization](/img/7d/2fefc32813ec0c93115e4b290b0944.png)
[optical flow] - data format analysis, flowwarp visualization
![[CSAPP] Application of bit vectors | encoding and byte ordering](/img/96/344936abad90ea156533ff49e74f59.gif)
[CSAPP] Application of bit vectors | encoding and byte ordering

稀疏数组→五子棋的存盘续盘等操作

Prime number screening (Ehrlich sieve method, interval sieve method, Euler sieve method)

Li Hongyi machine learning team learning punch in activity day05 --- skills of network design

Bean的生命周期&&依赖注入*依赖自动装配

JVM Part 1: memory and garbage collection part 11 -- execution engine

Database design - relational data theory (ultra detailed)

如何快速有效解决数据库连接失败问题

Day4 --- Flask 蓝图与Rest-ful
随机推荐
How to get started quickly and strengthen learning?
2022年郑州轻工业新生赛题目-打死我也不说
Selenium element operation
JDBC API details
B1021 个位数统计
[CSAPP] Application of bit vectors | encoding and byte ordering
How to quickly and effectively solve the problem of database connection failure
创建项目 实现登录注册,生成jwt,发送验证码
Database design - relational data theory (ultra detailed)
李宏毅机器学习组队学习打卡活动day01---机器学习介绍
牛客剑指offer--JZ12 矩阵中的路径
ERP system brand
Scientific Computing Library - numpy
BIO、NIO、AIO区别
SQL数据库→约束→设计→多表查询→事务
Student management system
Utility gadget: kotlin code snippet
B1025 反转链表*******
后台订单管理
Redis cluster