尝试通过 rest api 创建用户时获取“AuthenticationFailedInvalidHeader”

问题描述 投票:0回答:1

我正在尝试通过 azure rest api 使用 put 方法在 azure apim 中创建用户 url 看起来像这样 https://management.azure.com/subscriptions/7xxx/resourceGroups/xxx/providers/Microsoft.ApiManagement/service/wbgintapim/users/test?api-version=2022-08-01

授权标头就像

 Authorization  SharedAccessSignature integration&xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==

身体是

{
    "email": "[email protected]",
    "password": "Qwerty123$",
    "firstname": "test",
    "lastname": "apim"
}

我收到以下错误

{
    "error": {
        "code": "AuthenticationFailedInvalidHeader",
        "message": "Authentication failed. The 'Authorization' header is provided in an invalid format."
    }
}

可以在我做错的地方提供帮助 我要从这里拿钥匙

azure azure-api-management
1个回答
0
投票

如错误消息所示,您使用的授权标头值不正确。

查看文档

here
,仅当您直接管理 Azure APIM 实例时才支持共享访问签名授权标头。在这种情况下,您应该使用
https://{servicename}.management.azure-api.net
而不是您当前的 URL。

要解决此问题,请使用

https://{servicename}.management.azure-api.net
URL。如果你想使用 Azure 资源管理器 REST API,你会想要获得一个不记名令牌并像任何其他 Azure RM REST API 一样使用它进行授权。

© www.soinside.com 2019 - 2024. All rights reserved.