Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform Google云端点使用Auth0保护所有路径_Google Cloud Platform_Google Cloud Endpoints - Fatal编程技术网

Google cloud platform Google云端点使用Auth0保护所有路径

Google cloud platform Google云端点使用Auth0保护所有路径,google-cloud-platform,google-cloud-endpoints,Google Cloud Platform,Google Cloud Endpoints,我尝试使用security-swagger对象保护我的所有路径,API密钥工作得很好,但如何使用auth0或自定义身份验证来实现这一点 security: - api_key: [] securityDefinitions: api_key: type: "apiKey" name: "key" in: "query" 这不起作用 x-security: - auth0_jwk: audiences:

我尝试使用security-swagger对象保护我的所有路径,API密钥工作得很好,但如何使用auth0或自定义身份验证来实现这一点

security:
- api_key: []
securityDefinitions:
  api_key:
    type: "apiKey"
    name: "key"
    in: "query"
这不起作用

    x-security:
        - auth0_jwk:
            audiences:
              - "xxxxxxxxxxxxxxxx"
    securityDefinitions:
        auth0_jwk:
          # Replace YOUR-ACCOUNT-NAME with your Auth0 account name.
          authorizationUrl: "https://YOUR-ACCOUNT-NAME.auth0.com/authorize"
          flow: "implicit"
          type: "oauth2"
          x-issuer: "https://YOUR-ACCOUNT-NAME.auth0.com/"
          # Replace YOUR-ACCOUNT-NAME with your service account's email address.
          x-jwks_uri: "https://YOUR-ACCOUNT-NAME.auth0.com/.well-known/jwks.json"
还是这个

    security:
        - auth0_jwk:[
           "xxxxxxxxxxxxxxxx"
          ]
    securityDefinitions:
        auth0_jwk:
          # Replace YOUR-ACCOUNT-NAME with your Auth0 account name.
          authorizationUrl: "https://YOUR-ACCOUNT-NAME.auth0.com/authorize"
          flow: "implicit"
          type: "oauth2"
          x-issuer: "https://YOUR-ACCOUNT-NAME.auth0.com/"
          # Replace YOUR-ACCOUNT-NAME with your service account's email address.
          x-jwks_uri: "https://YOUR-ACCOUNT-NAME.auth0.com/.well-known/jwks.json"

“x-security”的招摇过市配置在我看来是正确的。如果没有错误消息,我不确定您的问题到底是什么。然而,人们在使用auth0身份验证时经常犯的一个常见错误是,他们没有正确设置JWT签名算法。默认情况下,JWT签名算法设置为“HS256”(对称密钥加密)。如果需要使用“RS256”(非对称密钥加密),则需要转到应用程序设置页面,在高级配置下的OAuth下,将“JsonWebToken签名算法”设置为RS256。

解决方案很简单,我对我的API使用express swaggerize,验证不了解x-security,并且给我错误是不允许的,这就是问题所在


对此帖子感到抱歉

谢谢你的回答,我知道这是关于RS256和HS256的。我的意思是,在这个示例中,我可以使用api密钥保护所有定义的路径,但如果尝试使用Auth0保护所有路径,它将不起作用。稍后我会用日志更新我的问题。谢谢你的回答,很抱歉这个问题