Firebase 令牌验证的误区
Misunderstanding in the Firebase's token verification
我想在服务器端使用 C++ 中的 this third party library 验证 Firebase 的令牌。但是我有一些误解:
对于令牌验证,我需要提供 public 和私钥,Firebase says that:
Must correspond to one of the public keys listed at
https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com
但是当我打开 link 时,我找不到 public 和我应该传递给令牌验证的私钥。
那么,如何才能得到public和验证token的私钥呢?
一般情况下,您只需要 public 密钥来验证 Firebase ID 令牌和 jwt。 link 包含 public 键 json object(我们称它为 publicKeysObject)。你得到JWT中的"kid"字段header然后得到publickey如下:publicKeysObject[kidFromJWT]
查看 Firebase Admin node.js SDK 开源实现以获取详细信息:https://github.com/firebase/firebase-admin-node/blob/master/src/auth/token-generator.ts
我想在服务器端使用 C++ 中的 this third party library 验证 Firebase 的令牌。但是我有一些误解: 对于令牌验证,我需要提供 public 和私钥,Firebase says that:
Must correspond to one of the public keys listed at https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com
但是当我打开 link 时,我找不到 public 和我应该传递给令牌验证的私钥。
那么,如何才能得到public和验证token的私钥呢?
一般情况下,您只需要 public 密钥来验证 Firebase ID 令牌和 jwt。 link 包含 public 键 json object(我们称它为 publicKeysObject)。你得到JWT中的"kid"字段header然后得到publickey如下:publicKeysObject[kidFromJWT]
查看 Firebase Admin node.js SDK 开源实现以获取详细信息:https://github.com/firebase/firebase-admin-node/blob/master/src/auth/token-generator.ts