【问题标题】:Google Endpoints with Auth0 Integration具有 Auth0 集成的 Google Endpoints
【发布时间】:2016-10-06 15:36:36
【问题描述】:

我尝试在 auth0 集成中使用 google 端点身份验证。

我不确定我该怎么做,我使用端点文档,但这并不完整。 当我部署它时它不起作用。

感谢您的帮助

这是我的招摇文件:

swagger: "2.0"
info:
  description: "A simple Google Cloud Endpoints API example."
  title: "Endpoints Example"
  version: "1.0.0"
host: "xxx.appspot.com"
basePath: "/"
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
paths:
  "/echo":
    get:
      description: "Echo back a given message."
      operationId: "echo"
      produces:
      - "application/json"
      responses:
        200:
          description: "Echo"
          schema:
            $ref: "#/definitions/echoMessage"
      security:
        - auth0_jwk: []
definitions:
  echoMessage:
    properties:
      message:
        type: "string"
  authInfoResponse:
    properties:
      id:
        type: "string"
      email:
        type: "string"
# This section requires all requests to any path to require an API key.
security:
- auth0_jwk: []
securityDefinitions:
  # This section configures basic authentication with an API key.
  api_key:
    type: "apiKey"
    name: "key"
    in: "query"
  # This section configures authentication using Google API Service Accounts
  # to sign a json web token. This is mostly used for server-to-server
  # communication.
  auth0_jwk:
    # Update YOUR-ACCOUNT-NAME with your Auth0 account name.
    authorizationUrl: "https://xxx.auth0.com/authorize"
    flow: "implicit"
    type: "oauth2"
    x-issuer: "https://xxx.auth0.com/"
    # Update this with your service account's email address.
    x-jwks_uri: "https://xxx.auth0.com/.well-known/jwks.json"

【问题讨论】:

  • 您得到的确切错误是什么?您正在关注哪个文档/教程?
  • 我没有收到任何错误,唯一的消息来自命令行并显示“/echo 路径不需要 apikey”。部署时我可以调用回显路径而不会出错。我遵循谷歌文档的端点。
  • 您期望发生什么?什么不工作?你用的是哪个教程?

标签: google-app-engine google-cloud-endpoints swagger-2.0 auth0


【解决方案1】:

您需要使用“x-security”而不是“security”。此外,为 auth0-jwk 指定受众,它可以是任何字符串(您的 JWT 令牌受众字符串必须与此处定义的“YOUR_AUDIENCE”匹配)。例如,

    x-security:
      - auth0-jwk:
          audiences:
          - "YOUR_AUDIENCE"

您可以在 https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/flexible/endpoints/swagger.yaml 找到示例 swagger 配置。

【讨论】:

    【解决方案2】:

    我正在研究“Google Cloud Endpoints”(ESP)和“Auth0”之间的集成,但遇到了一些障碍。目前,文档不是很清楚如何让它工作,但经过一些努力,我已经实现了它。您可以阅读我在 Google Groups 上的主题,我在其中提出了一个关于错误的问题。我认为它对您有帮助,因为它详细描述了基本设置。看看here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-20
      • 2017-11-29
      • 1970-01-01
      • 2016-02-20
      • 1970-01-01
      • 2017-07-06
      • 2017-04-29
      相关资源
      最近更新 更多