Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token 创建 albums 接口返回401 signature is invalid #3

Closed
chongdewu opened this issue Feb 19, 2020 · 1 comment
Closed

token 创建 albums 接口返回401 signature is invalid #3

chongdewu opened this issue Feb 19, 2020 · 1 comment
Assignees

Comments

@chongdewu
Copy link

之前一直觉得go的rest api轮子没有特别好用的,直到这几天发现强哥出了新的,甚是开心。
我是强哥的铁粉,早几年做PHP,跟随强哥的yii1,然后yii2,yii2 太好用了,至今没看的比yii2好用的框架。现在也跟随强哥的go轮子,在做golang了。

在使用的途中,发现登录之后,用token去创建 albums,提示401 signature is invalid

用jwt token的操作如下:
curl -X POST -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODIzNjI4MjgsImlkIjoiMTAwIiwibmFtZSI6ImRlbW8ifQ.UBTz2RJ0l92JRwRYpqQpOiNoaTVx9kheRP7gt0Xv9XE" -d '{"name": "demo321"}' http://localhost:8080/v1/albums

{"status":401,"message":"signature is invalid"}

我自己尝试看懂代码,想自己解决,无奈golang还不是很熟练,看了很久也没能找到解决办法,期待强哥的回复。

@qiangxue
Copy link
Owner

多谢你的支持!问题已经解决了,因为我们采用了HS256算法生成JWT,signing key 和 verification key应该是一样(对称)的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants