Flask中的JWT认证
HTTP认证方式:
- Basic
- Bearer
- JWT(JSON Web Token)
JWT的结构:

| Section name | meaning |
|---|---|
| HEADER | The first part stores the type of token and the encryption algorithm |
| PAYLOAD | The second part has the data that identifies the user: it can be its ID, user name, etc. |
| SIGNATURE | Digital signature, which is generated with the previous two sections, and it allows you to verify if the content has been modified. |
示例Python代码:
1 | |
创建JWT:
1 | |
验证JWT:
1 | |
Flask中的JWT认证
https://percent4.github.io/Flask中的JWT认证/