gpt4 book ai didi

go - 在 golang jwt-go 中解码 JWT

转载 作者:数据小太阳 更新时间:2023-10-29 03:02:57 26 4
gpt4 key购买 nike

这段代码(https://github.com/auth0/java-jwt)在 golang 中的等价物 --- jwt-go 库

  DecodedJWT jwt = JWT.decode(token);

在 golang 的 jwt-go 库中,当我必须解析 token 时,我需要具有 java 库中不需要的验证 key 。

最佳答案

来自文档 at :

func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error)

WARNING: Don't use this method unless you know what you're doing.

This method parses the token but doesn't validate the signature. It's only ever useful in cases where you know the signature is valid (because it has been checked previously in the stack) and you want to extract values from it.


[example]

关于go - 在 golang jwt-go 中解码 JWT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51874945/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com