使用 Microsoft Graph 在 Teams 中创建会议时出现“禁止”错误

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

我想使用 API 创建会议。 我使用此权限在 Azure 门户中创建了一个应用程序:

OnlineMeetings.ReadWrite

接下来,我按照 OAuth 流程获取了访问令牌(我删除了对令牌的部分访问权限并复制到此处):

{
  "aud": "00000003-0000-0000-c000-000000000000",
  "iss": "https://sts.windows.net/bbf86088-73dc-4587-89d3-33e6f9a1484f/",
  "name": "Meet master account",
  "oid": "90ac29be-2d4f-4e9b-a13c-b5abf8534cef",
  "platf": "5",
  "puid": "10032002F2311268",
  "scp": "OnlineMeetings.ReadWrite User.Read profile openid email",
  "signin_state": [
    "kmsi"
  ],
  "sub": "KfOfRbaUEccxbfM5KfcWDjzX1gRtijFJ7Qgqw09oslU",
  "tenant_region_scope": "NA",
  "tid": "bbf86088-73dc-4587-89d3-33e6f9a1484f",
  "uti": "nQXEiowwn0SGCHPDY0IhAA",
  "ver": "1.0",
}

之后我提出了这样的要求:

POST https://graph.microsoft.com/v1.0/me/onlineMeetings
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "startDateTime":"2022-01-01T14:30:34.2444915-07:00",
  "endDateTime":"2022-01-01T15:00:34.2464912-07:00",
  "subject":"Test Meeting"
}

我收到这样的回复:

{
    "error": {
        "code": "Forbidden",
        "message": "An error has occurred.",
        "innerError": {
            "date": "2023-09-14T09:32:46",
            "request-id": "39c6117b-7f71-43d2-bc73-c21893c0d120",
            "client-request-id": "39c6117b-7f71-43d2-bc73-c21893c0d120"
        }
    }
}

我不确定为什么会发生这个错误。

node.js azure microsoft-teams
1个回答
0
投票

如果您尝试与 来宾用户 或租户中没有

Microsoft Teams
许可证的用户创建在线会议,通常会发生此错误。

我创建了一个新租户,并通过授予 API 权限 注册了一个 Azure AD 应用程序,如下所示:

enter image description here

现在,我通过 Postman 使用授权代码流生成了 访问令牌,如下所示:

POST https://login.microsoftonline.com/<tenantID>/oauth2/v2.0/token

grant_type:authorization_code
client_id: <appID>
client_secret: <secret>
scope: OnlineMeetings.ReadWrite
code:code
redirect_uri:https://jwt.ms

回复:

enter image description here

为了检查

scp
upn
声明,我在 jwt.ms 网站中解码了上述访问令牌,如下所示:

enter image description here

当我使用此令牌创建在线会议时,我也遇到了相同的错误,因为租户有没有有效的许可证:

POST https://graph.microsoft.com/v1.0/me/onlineMeetings
Authorization: Bearer <token>
Content-Type: application/json

{
  "startDateTime":"2022-01-01T14:30:34.2444915-07:00",
  "endDateTime":"2022-01-01T15:00:34.2464912-07:00",
  "subject":"Test Meeting"
}

回复:

enter image description here

解决错误,请确保至少拥有一个 Office 365 您的租户中的许可证,其中包含

Microsoft Teams

当我与拥有适当许可证的租户尝试相同的操作时,在线会议已成功创建,响应如下:

POST https://graph.microsoft.com/v1.0/me/onlineMeetings
Authorization: Bearer <token>
Content-Type: application/json

{
  "startDateTime":"2022-01-01T14:30:34.2444915-07:00",
  "endDateTime":"2022-01-01T15:00:34.2464912-07:00",
  "subject":"Test Meeting"
}

回复:

enter image description here

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