firebase - Firebase 用户对象在 Localhost 上为空
问题描述
我在 localhost 上遇到 Firebase 令牌问题。
@Api(name = "account",
version = "v1",
authenticators = {EspAuthenticator.class},
issuers = {@ApiIssuer( name = "firebase",
issuer = "https://securetoken.google.com/PROJECTID",
jwksUri = "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com")},
issuerAudiences = {@ApiIssuerAudience(name = "firebase", audiences = {"PROJECTID"})})
public class AccountService {
@ApiMethod(path="user/{id}", httpMethod = "get")
public User GetUser(@Named("id") String id, User user) throws UnauthorizedException,BadRequestException,NotFoundException
{
}
}
特别是应该返回 com.google.api.server.spi.auth.common.User 的用户用户。当我在谷歌云上运行它时,我得到了正确的结果。
当我在 localhost 上运行它时,它总是返回 null。
我无法弄清楚我做错了什么,因为 Localhost 默认情况下应该可以使用 firebase,如下所示。为什么我在 localhost 上看不到用户对象?
解决方案
该问题与此现有问题有关。 Google Cloud Endpoints + Firebase 身份验证:未设置 method_info
openapi 文档尚未部署,因此未包含用户。调用以下解决了这个问题: -
gcloud endpoints services deploy target/openapi-docs/openapi.json
推荐阅读
- python - 从每个客户 id 的下一列中识别最后一个 yes 值和 0,然后从上一行下一列 pandas 中获取值
- google-cloud-platform - 为什么使用 JVM Google Cloud Functions 连接到 MongoDB Atlas 这么慢?
- python - 用python中相同时间序列中的重复值填充时间序列中的缺失值
- kubernetes - Kubernetes Pod Horizontal Autoscaling 安全排水,celery worker 缩减中途工作
- javascript - 在开发greasemonkey 脚本时如何检查值和字段?
- javascript - 带有选择标签 Vue/Mongo DB 的过滤器选项
- corretto - 如何使用新版本更新 Amazon Corretto 8
- python - VS Code:python 中的 site-packges 模块没有属性?
- kotlin - kotlin:将字符串与 Int 值连接起来
- android - 我想从 Authenticator 类中的 okhttp3.Response 生成自定义错误