JWT 令牌的最大大小是多少? [英] What is the maximum size of JWT token?

查看:45
本文介绍了JWT 令牌的最大大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道最大长度

JSON 网络令牌 (JWT)

JSON Web Token (JWT)

在规范中没有关于它的信息.难不成,没有长度限制?

In specs there are no information about it. Could be that, there are no limitations in length ?

推荐答案

正如你所说,RFC7519 中没有定义最大长度(https://www.rfc-editor.org/rfc/rfc7519) 或其他与 JWS 或 JWE 相关的 RFC.

As you said, there is no maximum length defined in the RFC7519 (https://www.rfc-editor.org/rfc/rfc7519) or other RFCs related to JWS or JWE.

如果您使用 JSON Serialized 格式或 JSON Flattened Serialized 格式,则没有限制,也没有理由定义限制.

If you use the JSON Serialized format or JSON Flattened Serialized format, there is no limitation and there is no reason to define a limitation.

但如果您使用 JSON Compact Serialized 格式(最常见的格式),您必须记住它应该尽可能短,因为它主要用于 Web 上下文.应该避免使用 4kb JWT.

But if you use the JSON Compact Serialized format (most common format), you have to keep in mind that it should be as short as possible because it is mainly used in a web context. A 4kb JWT is something that you should avoid.

注意只存储有用的声明和标题信息.

Take care to store only useful claims and header informations.

这篇关于JWT 令牌的最大大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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