【发布时间】:2020-05-12 07:54:10
【问题描述】:
我正在尝试路由具有 REST API 的 Web 服务的数据:http://demo.akeneo.com/api/rest/v1/categories
我为此使用 Azure API 管理服务。我已经创建了一个 Azure API 管理服务和一个空白 API。我为此创建了一个 GET 方法。在测试此 API 时,我遇到如下错误:
HTTP/1.1 401 Unauthorized
cache-control: max-age=0, must-revalidate, no-store, private
content-security-policy: default-src 'self' *.akeneo.com 'unsafe-inline'; script-src 'self' 'unsafe-eval' 'nonce-07f41c14e74157aff6fa6296dac0027c13e46705'; img-src 'self' data: ; frame-src * ; font-src 'self' data:
content-type: application/json
date: Tue, 12 May 2020 07:05:18 GMT
expires: Tue, 12 May 2020 07:05:18 GMT
ocp-apim-trace-location: https://apimst3v04xlapwxf3c99avt.blob.core.windows.net/apiinspectorcontainer/9kvUzyqpMfhQQii4nn7e49QLxiE1-16?sv=2018-03-28&sr=b&sig=e9ETEXuY0pbzxyM%2FLBsJiidcrVL%2BROf1FnZ9652IDfw%3D&se=2020-05-13T07%3A05%3A18Z&sp=r&traceId=ba521452333d475b95521351d7ac19f3
pragma: no-cache
transfer-encoding: chunked
vary: Origin
www-authenticate: Bearer realm="Service", error="access_denied", error_description="OAuth2 authentication required"
x-content-security-policy: default-src 'self' *.akeneo.com 'unsafe-inline'; script-src 'self' 'unsafe-eval' 'nonce-07f41c14e74157aff6fa6296dac0027c13e46705'; img-src 'self' data: ; frame-src * ; font-src 'self' data:
x-frame-options: sameorigin
x-webkit-csp: default-src 'self' *.akeneo.com 'unsafe-inline'; script-src 'self' 'unsafe-eval' 'nonce-07f41c14e74157aff6fa6296dac0027c13e46705'; img-src 'self' data: ; frame-src * ; font-src 'self' data:
{
"error": "access_denied",
"error_description": "OAuth2 authentication required"
}
当我将安全性更改为 OAuth 2.0 时,它会显示未配置 OAuth 2.0 服务器。 请任何人帮助如何配置 OAuth 2.0 服务器。此外,我在 Azure API 管理服务中使用的方法是正确获取 REST API 的数据。如果有其他解决方法,请说明。 Image for reference in the Link
【问题讨论】:
-
demo.akeneo.com/api/rest/v1/categories 是您的 Web 服务 api 还是 apim 端点?
-
它是一个Web服务API(REST API)
-
那么你的api已经被OAuth2认证保护了吗?提供者是什么?
-
akeneo 是提供者。您可以在他们的 API 规范中检查它以进行身份验证。在邮递员中,它使用 Header 进行身份验证。
标签: azure api azure-api-management