【发布时间】:2017-09-19 19:48:21
【问题描述】:
我希望在没有用户交互的情况下获取访问令牌,以便自动调用 Azure 服务(计算、网络等)的 REST API。 In the documentation,列出了几种认证场景。最适合我的用例的是“Daemon or Server Application to Web API”。
我按照instructions 请求访问令牌:首先我在我的 Azure Active Directory 中注册了一个应用程序。然后我创建了一个与应用程序 ID(client_id 参数)关联的密钥(client_secret 参数)。我还获得了 App ID URI(资源参数)。我使用所有这些参数向我的 Azure AD 的 /token 端点创建了一个 POST 请求。但是我收到以下错误消息:
{
"code":"InvalidAuthenticationTokenAudience",
"message":"The access token has been obtained from wrong audience or resource 'https://solutionsmosaixsoft.onmicrosoft.com/<APP_ID_URI>'. It should exactly match (including forward slash) with one of the allowed audiences 'https://management.core.windows.net/','https://management.azure.com/'."
}
我做错了什么?我是否将资源参数设置为错误的值?
【问题讨论】:
标签: rest azure authentication oauth-2.0 azure-active-directory