Is it safe to put a jwt (json web token) into the url as a query parameter of a GET request?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It can be safe under the following circumstances:
- the JWT is one-time time usage only
- the
jti
andexp
claims are present in the token - the receiver properly implements replay protection using
jti
andexp
but in case it is used as a token that can repeatedly be used e.g. against an API then supplying it as a query parameter is less preferred since it may end up in logs and system process information, available to others that have access to the server or client system. In that case would be better to present it as part of a header or a POST parameter.
Besides that, by using it in the query parameters you may run in to URL size limitations on browsers or servers; using it in a header provides some more space, using it as a POST paramter would work best.