Restful JWT

什么是JWT(Json Web Token)

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.

应用场景

  1. Authentication

  2. Information Exchange

JWT结构

JSON Web Tokens consist of three parts separated by dots (.), which are:

  • Header
  • Payload
  • Signature

完整表达式:xxxxx.yyyyy.zzzzz

一般情况下,主要由两部分组成:token类型和使用的Hash算法,例如

1
2
3
4
{
"alg": "HS256",
"typ": "JWT"
}

使用Base64Url编码Header作为JWT的第一部分


相关链接:https://jwt.io/