使用 Dgraph 身份验证时 Firebase 身份验证模拟器无法签署 JWT

时间:2021-04-06 07:59:57

标签: firebase firebase-authentication jwt dgraph

我正在努力寻找一种使用 Firebase 身份验证模拟器和 Dgraph 的好方法。在 Dgraph 中,您发送一个 JWT,其中包含您可以检查 Dgraph 以允许/限制查询和突变的声明。

在 Dgraph 模式中,您需要添加以下代码:

# Dgraph.Authorization {"Header":"X-Auth-Token","Namespace":"https://dgraph.io/jwt/claims","JWKURL":"https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com","Audience":["firebase-project-id"]}

我发现使用 firebase 身份验证模拟器时 JWKURL 值无效。它返回此错误。

couldn't rewrite query getUser because unable to parse jwt token:token is unverifiable: Keyfunc returned an error

当我尝试使用 localhost url 时,Dgraph 失败,因为它无法连接到它。

例如:

localhost:9099/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com

我该如何解决这个问题?

0 个答案:

没有答案