我正在尝试找到一种使用 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"]}
我发现JWKURL
使用 firebase auth 模拟器时该值无效。它返回此错误。
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
我怎样才能解决这个问题?