我尝试使用以下node.js脚本为我的插件生成JWT令牌
var jwt = require('jsonwebtoken');
var issuedAt = Math.floor(Date.now() / 1000);
var payload = {
iss: 'user:5617820:496',
jti: Math.random().toString(),
iat: issuedAt,
exp: issuedAt + 60,
};
var secret = '.mysecret.'
// store this securely.
var token = jwt.sign(payload, secret, {algorithm: 'HS256',// HMAC-SHA256 signing algorithm
});
console.log(token);
然后我使用此令牌发出命令:
C:\卷曲> curl.exe https://addons.mozilla.org/api/v3/addons/EasyFa@EasyFa.txt/versions/1.0.1-signed -g -XPUT - 表'upload = build / easyfa-1.0-fx.xpi'-H'授权:JWT eyJ0 ...... HI'
但有错误:
我在这里缺少什么想法? 感谢