我嘗試使用安全swagger對象保護所有路徑,使用API密鑰工作得很好,但我如何使用auth0或自定義身份驗證執行此操作?Google Cloud Endpoints使用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"
感謝您的回答,我知道這關於RS256和HS256。我的意思是在這個例子中,我可以使用api key來保護所有定義的路徑,但是當使用Auth0保護所有路徑時,它不會工作。稍後我會用日誌更新我的問題。謝謝 – Aron
感謝您的回答,並對此問題感到抱歉 – Aron