从网络应用创建呼叫时如何解决“不受支持的AAD身份”?

时间:2019-07-20 10:03:08

标签: microsoft-graph

当我从Web应用程序中调用此命令时,出现错误代码9000 - "Unsupported AAD Identity"

POST https://graph.microsoft.com/beta/app/calls

请求标头:

{
  "Content-type" => "application/json",
  "Authorization" => "Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IkFRQUJBQUFBQUFBUDB3TGxxZExWVG9PcEE0a3d6U254TkY3UDFxM05tT0xEOHZJVXk0NmFtVWRaV1ZhbGdFUWx2Vkw4Mmp4cS1tZFpwOWdiY1kwdVB4U3ctOGlGd3JRM00zUWlBS29KS08zRzN3czNsNlFmZXlBQSIsImFsZyI6IlJTMjU2IiwieDV0IjoidTRPZk5GUEh3RUJvc0hqdHJhdU9iVjg0TG5ZIiwia2lkIjoidTRPZk5GUEh3RUJvc0hqdHJhdU9iVjg0TG5ZIn0.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81NGRkYWJiMS1kNjU5LTRhZmYtODNkZi1kYzUwODk2OTI3YjgvIiwiaWF0IjoxNTYzODQxMTQ2LCJuYmYiOjE1NjM4NDExNDYsImV4cCI6MTU2Mzg0NTA0NiwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkFTUUEyLzhNQUFBQWlhS2hob3hBalByVHJsOEZVc0w0Q2Y2Zkc4M2x4YVpIWXVYOTJaT0w5eDQ9IiwiYW1yIjpbInB3ZCIsInJzYSJdLCJhcHBfZGlzcGxheW5hbWUiOiJNeSBSdWJ5IEFwcCIsImFwcGlkIjoiYTFlMjliY2YtODYxOS00ZjVjLWEzMjAtNmY2N2QzMGZiOTlkIiwiYXBwaWRhY3IiOiIxIiwiZGV2aWNlaWQiOiJjMThiZDJmYS05YzhkLTRlOGItYTUwMi1lYWFlMmI2YzM1NjYiLCJmYW1pbHlfbmFtZSI6IuWFqOS9kyIsImdpdmVuX25hbWUiOiL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6mFzswnoK30smEH6l7VW-gkzrxc2JFuDh-nKvfemTKnI3O_ZjtrEJNp-sWZF5Enm28Mg5Lh4hfBrSiROO8b0gAMytLWx9Qjy3H5x_zzdy34D1B1O8nCFrx217olDzarDCd6KqPtfCqoS00mWqCIwlEvHSi7OCtBV0HaUEl07-hi9hovu-uaHTLRW50fFP9hfoWYOz5qRyidpGNRtR26rUtexlOXtceZKYv5fD_VFNiBdT7d06EiK58UBib08eHjcvNJ6NEhcW0xTOxA"
}

请求正文:

{
  "callbackUri": "https://bot.contoso.com/api/calls",
  "mediaConfig": {
    "@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
    "preFetchMedia": [
      {
        "uri": "https://cdn.contoso.com/beep.wav",
        "resourceId": "1D6DE2D4-CD51-4309-8DAA-70768651088E"
      },
      {
        "uri": "https://cdn.contoso.com/cool.wav",
        "resourceId": "1D6DE2D4-CD51-4309-8DAA-70768651088F"
      }
    ]
  },
  "source": {
    "identity": {
      "application": {
        "id": "RealAppId"
      }
    },
    "languageId": "languageId-value",
    "region": "region-value"
  },
  "subject": "Test Call",
  "targets": [
    {
      "identity": {
        "user": {
          "id": "RealTargetUserId",
          "tenantId": "RealTenantId",
          "displayName": "RealName"
        }
      }
    }
  ],
  "tenantId": "tenantId-value"
}

响应:

{
  "error": {
    "code": "UnknownError",
    "message": "{
      "errorCode": "9000",
      "message": "Unsupported AAD Identity.",
      "instanceAnnotations": []
    }",
    "innerError": {
      "request-id": "RealRequestId",
      "date": "2019-07-23T00:25:12"
    }
  }
}

在请求正文中,RealTargetUserId是提供了E1许可证的Azure ActiveDirectory用户ID。 RealAppId是注册的应用程序ID,其权限如下:

Calls.AccessMedia.All
Calls.Initiate.All
Calls.InitiateGroupCall.All
Calls.JoinGroupCall.All
Calls.JoinGroupCallAsGuest.All

2 个答案:

答案 0 :(得分:1)

要解决“应用程序未在我们的商店中注册”的问题,您需要确保使用Bot频道注册,而不仅仅是正常的应用程序注册。

Bot频道注册还应该具有Microsoft Teams作为注册频道并启用呼叫。

有关更多信息,请参见:https://microsoftgraph.github.io/microsoft-graph-comms-samples/docs/articles/calls/register-calling-bot.html

如果只关心API访问权限,则可以跳过在团队中添加机器人的最后一步。

答案 1 :(得分:0)

根据文档,您需要使用以下应用程序范围之一来创建调用:Calls.JoinGroupCallsasGuest.AllCalls.JoinGroupCalls.AllCalls.Initiate.AllCalls.InitiateGroupCalls.All

但是,您正在使用的身份验证令牌正在使用Delegated范围。这告诉我您正在使用OAuth的身份验证代码或隐式授权流。这些都不适用于此操作。

要使用此终结点,您需要使用OAuth客户端凭据授予请求仅应用令牌。 Get access without a user文档中包含有关如何执行此操作的说明。

此外,您正在请求权限范围。例如,不需要请求User.ReadUser.Read.All User.ReadBasic.All,您只需要User.Read.All就可以完成同一件事。 Group.Read.AllGroup.ReadWrite.All也是如此。