Azure 存储身份验证失败 - 受众验证失败。观众不匹配。 [ azure ][OAuth]

标签 azure azure-active-directory azure-storage azure-blob-storage azure-authentication

我尝试使用以下代码对 Azure 存储进行 REST 调用。 enter image description here

但它显示以下错误:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
   <Code>AuthenticationFailed</Code>
   <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\n' +
        'RequestId:11c07be7-301e-0003-556f-42091d000000\n' +
        'Time:2021-05-06T11:59:40.1049759Z</Message>
   <AuthenticationErrorDetail>Audience validation failed. Audience did not match.</AuthenticationErrorDetail>
</Error>

我已经分配了角色: enter image description here

并设置 API 权限: enter image description here

但是还是这个错误。有人可以帮忙吗?

最佳答案

您的访问 token 的受众不正确。 aud(受众)应类似于 https://xxxx.blob.core.windows.net

请求访问 token 时,请确保范围https://{account-name}.blob.core.windows.net/user_impersonation

enter image description here

关于Azure 存储身份验证失败 - 受众验证失败。观众不匹配。 [ azure ][OAuth],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67418149/

相关文章:

reactjs - 使用react-aad-msal从react SPA调用web api缺少范围

azure-storage - 将文件从 Azure BLOB 存储复制到 SharePoint 文档库

azure - 使用 ARM 模板创建 Azure 存储队列

Azure DocumentDB Multi-Tenancy 架构

amazon-web-services - 将用java编写的Azure函数迁移到AWS Lambda函数

具有自定义域的用户的 Azure AD B2B 身份验证错误 - AADSTS65005 : Using application 'My Application' is currently not supported

angular - 在 Azure AD B2C 门户中使用 loginRedirect 生成访问 token

asp.net-mvc - 无法创建正确的 OpenID Connect 配置端点 (v2)

java - Azure表存储无效输入

javascript - 上传时 Azure blob 的名称/文件名