为什么 JWT 令牌中的 header 和 payload 总是以 eyJ 开头 [英] Why header and payload in the JWT token always starts with eyJ

查看:11
本文介绍了为什么 JWT 令牌中的 header 和 payload 总是以 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 令牌中的 header 和 payload 总是以 eyJ 开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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