小编Inc*_*ate的帖子

Firebase 3.0 令牌:[错误:身份验证标头中的“孩子”声明无效。]

我正在尝试在 node.js 中创建 JWT 令牌以与 firebase 中的 REST api 一起使用,但是当我尝试使用它们时,我收到错误“错误:身份验证标头中的无效声明 'kid'”。

这是我的代码

http.createServer(function (req, res) {
    var payload = {
        uid: "bruh"
    };

    var token = jwt.sign(payload, sact["private_key"], {
        algorithm: 'RS256',
        issuer: sact["client_email"],
        subject: sact["client_email"],
        audience: 'https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit',
        expiresIn: '3600s',
        jwtid: sact["private_key_id"],
        header: {
            "kid": sact["private_key_id"]
        }
    });

    res.writeHead(200);
    res.end("It worked. (" + token + ")");
}).listen(port);
Run Code Online (Sandbox Code Playgroud)

这些是我的要求

var http = require('http');
var jwt = require('jsonwebtoken');
Run Code Online (Sandbox Code Playgroud)

token node.js jwt firebase

0
推荐指数
1
解决办法
2254
查看次数

标签 统计

firebase ×1

jwt ×1

node.js ×1

token ×1