未配置返回 Jwt 颁发者的 Google Cloud Endpoints POST

问题描述

我正在 Google Cloud Endpoints 上设置 POST 请求,但它总是返回:

{
  "message": "Jwt issuer is not configured","code": 401
}

我相信我检查了所有内容,但仍然无法正常工作。我不确定是否缺少文件(Node 或 Python 文件?),我不确定。这是我的 openapi.yaml 文件

# [START swagger]
swagger: "2.0"
info:
  title: "xxxxx"
  description: "API endpoints and service functions"
  version: "1.0.0"
  termsOfService: "https://xxxxxx.com/terms"
  contact:
    name: "xxxxx"
    url: "xxxxx"
    email: "xxxxx"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "xxxxx.com"
x-google-endpoints:
  - name: "xxxxx"
    allowCors: true
x-google-allow: "configured"
x-google-issuer: "accounts.google.com"
x-google-jwks_uri: "https://www.googleapis.com/robot/v1/Metadata/x509/xxxxx.iam.gserviceaccount.com"
x-google-backend:
  address: "https://xxxxx.cloudfunctions.net"
  jwt_audience: "xxxxx.apps.googleusercontent.com"
  path_translation: "CONSTANT_ADDRESS"
  deadline: 15.0
  protocol: "h2"
security:
  - api_key: []
consumes:
  - "application/json"
  - "text/html"
produces:
  - "application/json"
  - "text/html"
schemes:
  - "https"
# [END swagger]
paths:
  "/auth/google_id":
    get:
      description: "Returns the requests' authentication information."
      operationId: "authGoogleId"
      produces:
        - "application/json"
      responses:
        200:
          description: "Authenication info."
          schema:
            $ref: "#/deFinitions/authInfoResponse"
      security:
        - google_id: []
          api_key: []
  "/auth/google_sa":
    get:
      description: "Returns authentication from request"
      operationId: "authGoogleSA"
      produces:
        - "application/json"
      responses:
        200:
          description: "Authentication info"
          schema:
            $ref: "#/deFinitions/authInfoResponse"
      security:
        - google_sa: []
          api_key: []
  "/auth/firebase":
    get:
      description: "Firebase authentication"
      operationId: "authFirebase"
      produces:
        - "application/json"
      responses:
        200:
          description: "Firebase success response"
          schema:
            $ref: "#/deFinitions/authInfoResponse"
      security:
        - firebase: []
          api_key: []
  "/echo":
    post:
      description: "Echo back a given message."
      operationId: "echo"
      produces:
        - "application/json"
      responses:
        200:
          description: "Echo success message"
          schema:
            $ref: "#/deFinitions/echoMessage"
      parameters:
        - description: "Message to echo"
          in: body
          name: message
          required: true
          schema:
            $ref: "#/deFinitions/echoMessage"
      security:
        - google_id: []
          api_key: []
  "/query_tables":
    get:
      summary: "Query data tables"
      operationId: "query_tables"
      produces:
        - "application/json"
      parameters:
        - name: "table"
          in: "path"
          description: "Table to search"
          required: true
          type: "string"
        - name: "column"
          in: "path"
          description: "Column to select"
          required: true
          type: "string"
      x-google-backend:
        address: "https://xxxxx.cloudfunctions.net/query_tables"
        protocol: "h2"
        path_translation: "CONSTANT_ADDRESS"
      responses:
        200:
          description: "Success"
          schema:
            $ref: "#/deFinitions/tableObject"
        404:
          description: "Failure"
          schema:
            $ref: "#/deFinitions/GeneralError"
      security:
        - google_id: [
          "email:https://www.googleapis.com/auth/userinfo.email","profile:https://www.googleapis.com/auth/userinfo.profile"
        ]
          api_key: []
deFinitions:
# [START responseDef]
    echoMessage:
      type: "string"
      properties:
        message:
          type: "string"
    tableObject:
      type: "object"
      properties:
        message:
          type: "string"
    authInfoResponse:
      properties:
        id:
          type: "string"
          description: "First name of the user"
        first_name:
          type: "string"
          description: "First name of the user"
        last_name:
          type: "string"
          description: "Last name of the user"
        email:
          type: "string"
          description: "Email address of the user"
        picture:
          type: "string"
          description: "Image URL of the user"
    NotFound:
      description: "Entity not found"
    IllegalInput:
      description: "Illegal input for operation"
    GeneralError:
      description: "General error"
# [END responseDef]
securityDeFinitions:
# [START securityDef]
    api_key:
      type: "apiKey"
      name: "key"
      in: "query"
    google_id:
      type: "oauth2"
      flow: "implicit"
      authorizationUrl: "https://accounts.google.com/o/oauth2/auth"
      x-google-issuer: "accounts.google.com"
      x-google-jwks_uri: "https://www.googleapis.com/oauth2/v3/certs"
      x-google-audiences: "xxxxx"
      x-google-jwt-locations:
        - header: "Authorization"
          value_prefix: "Bearer "
    google_sa:
      type: "oauth2"
      flow: "implicit"
      authorizationUrl: "https://accounts.google.com/o/oauth2/auth"
      x-google-issuer: "xxxxx.iam.gserviceaccount.com"
      x-google-jwks_uri: "https://www.googleapis.com/robot/v1/Metadata/x509/#xxxxx.iam.gserviceaccount.com"
      x-google-audiences: "xxxxx.apps.googleusercontent.com"
      x-google-jwt-locations:
        - header: "Authorization"
          value_prefix: "Bearer "
# [START firebaseAuth]
    firebase:
      authorizationUrl: ""
      flow: "implicit"
      type: "oauth2"
      x-google-issuer: "https://securetoken.google.com/mpa-work-flows"
      x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/Metadata/x509/xxxxx.gserviceaccount.com"
      x-google-audiences: "xxxxx"
      x-google-locations:
        - header: "Authorization"
          value_prefix: "Bearer "
# [END firebaseAuth]
# [END securityDef]

我是云端点的初学者。希望你能帮忙。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)