找不到信封的 pem:{"alg":"RS256","kid":"5a66482db3800c83c63","typ":"JWT"}

Kun*_*kla 5 node.js jwt google-oauth reactjs

我正在尝试验证和解码前端发送的 id 令牌。运行验证函数时出现此错误。有时它可能会起作用。

No pem found for envelope: {"alg":"RS256","kid":"53c666482db3800c83c63","typ":"JWT"}
Run Code Online (Sandbox Code Playgroud)

这是我的代码

        const ticket = await client.verifyIdToken({
        idToken: token,
        audience: '804312674051-5o4.apps.googleusercontent.com',
    });
    const payload = ticket.getPayload();
Run Code Online (Sandbox Code Playgroud)

Mar*_*son 0

我遇到了同样的问题....使用我从我的reactJS应用程序的firebase登录中获得的idToken。

我在 google src 文件中发现

if (!certs.hasOwnProperty(envelope.kid)) {
    // If this is not present, then there's no reason to attempt verification
    throw new Error('No pem found for envelope: ' + JSON.stringify(envelope));
  }
Run Code Online (Sandbox Code Playgroud)

但我不知道这意味着什么。