无法使用firebase身份验证访问`Google Endpoints API`

时间:2017-08-13 17:40:31

标签: firebase firebase-authentication google-cloud-endpoints openapi

抱歉,我不知道我是否应该在这里提问。我使用了echo示例项目和 将其部署到google cloud endpoints,我想使用firebase auth而不是api key对其进行配置。以下是openapi.yaml

paths:
  "/echo":
  post:
    description: "Echo back a given message."
    operationId: "echo"
    produces:
      - "application/json"
    responses:
      200:
        description: "Echo"
        schema:
          $ref: "#/definitions/echoMessage"
    parameters:
      - description: "Message to echo"
        in: body
        name: message
        required: true
        schema:
          $ref: "#/definitions/echoMessage"
    security:
      - firebase: []

当我部署它并使用

访问时
curl -d '{"message":"hello world"}' -H "content-
type:application/json""http://[IPADDRESS]:80/echo"

我收到错误消息。

 "message": "Method doesn't allow unregistered callers (callers without 
 established identity). Please use API Key or other form of API consumer 
 identity to call this API.",

如果我添加api密钥。

curl -d '{"message":"hello world"}' -H "content-type:application/json""http://35.194.225.89:80/echo?api_key=[API_KEY]"

我可以得到正确的结果。

我不确定如何配置openapi.yaml,请帮忙。非常感谢你。

0 个答案:

没有答案
相关问题