为什么JWT令牌中的标头和有效载荷始终以eyJ开头 [英] Why header and payload in the JWT token always starts with eyJ

查看:573
本文介绍了为什么JWT令牌中的标头和有效载荷始终以eyJ开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JWT令牌来授权我的API,在实现过程中,我发现令牌中的标头和有效载荷始终以eyJ开头.这说明什么?

I am using JWT token to authorize my APIs, during implementation I found header and payload in token always start with eyJ. What does this indicate?

推荐答案

JWT由 base64url编码的JSON组成,并且JSON结构仅以{"...开头,当使用base64编码器进行编码时,该格式将变为ey.... JWT标头以{"alg":...开头,然后变为eyJ...

JWTs consist of base64url encoded JSON, and a JSON structure just starts with {"..., which becomes ey...when encoded with a base64 encoder. The JWT header starts with {"alg":..., which then becomes eyJ...

您可以尝试使用在线编码器,然后输入{"alg"并单击编码".结果将是eyJhbGciPSA=

You can try on this online encoder and enter {"alg" and click on encode. The result will be eyJhbGciPSA=

这篇关于为什么JWT令牌中的标头和有效载荷始终以eyJ开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆