我正在尝试创建在线会议,但这样做时出现错误。我在 Azure 门户(免费计划)上注册了一个应用程序,我用它来卷曲请求。这是我为了能够查询 Microsoft Graph API 而设置的权限:
授权
https://login.microsoftonline.com/0147041e-e3f7-47b7-b821-xxxxxx/oauth2/v2.0/authorize?
&client_id=bb962351-xxx-41b7-8532-xxxxxxxx
&response_type=code
&redirect_uri=https://jwt.ms
&response_mode=query
&scope=https://graph.microsoft.com/.default
&state=12345
获取code成功。接下来我调用了token api
curl -X POST \
'https://login.microsoftonline.com/0147041e-e3f7-47b7-b821-xxxxxx/oauth2/v2.0/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=bb962351-xxx-41b7-8532-xxxxxxxx' \
-d 'grant_type=authorization_code' \
-d 'scope=https://graph.microsoft.com/.default' \
-d 'code=0.Ab4AHgRHAffjt0e4IUMRETnjJVEjlrtD3bdBhTJz3y0ap66-AKI.AgABBAIAAADnfolhJpSnRYB1SVj-Hgd8AgDs_wUA9P8c97uVUoULLvu0a73XRIPk3NR4Pux5Dv4GQJVw720mbJeeIshoy2K6NIaqTJ4vgv9VunP0s9lvtfwGCbN3lwzlAa3qjHVFF2qHzxfu19oAz1X-L3DsTeEK_4AsVHzt3jZXqC6WhiLo4N_kx-VyUZO_Uegn6SBHcaPPq3JAS1xG-oFm5csWKRLtyBZMe_VougAnknJfsOtpE3NrTNrEA3g3SPihQ1RCVIK57kngdMzSpgg6TWorknBaPNm6zvX4-vUUkExklWI4_dcnQ_XQ9Zt5AAIBzVcvd3bTD5Rr91JlH16e_PEWusxdTm92YoT_sx3Q5ETJx_BYyXVxUheR-GqGAlPFxbLSFR3N7qCjlycLHhfs8wDN8y6-9JsdROqrGntWad1cMS8wVaFvywvJyxkrvWIEZlrq6mPBegEv2Zl5KHW7_nNj2slzxpVTvit0Gu2iWRAsVwdqS59EU_2qO8SzehSlD02CBhm-U_ob-ECMNbuOmU5R4c-OPYqwCk4LhfDi8NhbO3XbImdHXIqRM-SSaB1SwFCEEMUfe-TxF9nTHZuO-gvvK_QE0QmqbAjqchXnP_ZH1Dxyu8kmb9kG01PeRuPEYac3dA' \
-d 'redirect_uri=https://jwt.ms' \
-d 'client_secret=T_H8Q~gYZcmFRXARYgt_cB5Np5k_xxxxxxxx'
并且access_token也获取成功了
步骤3:
调用 onlinemeeting api 时出现错误,我也尝试了 users/{userid}/onlineMeetings
curl -X POST https://graph.microsoft.com/v1.0/me/onlineMeetings -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6Im5welg1d2ZCNW1hcU40bnhmRUJNQVRCTkxxTkNZVWRSVU1QOGYyRmJ3VW8iLCJhbGciOiJSUzI1NiIsIng1dCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCIsImtpZCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8wMTQ3MDQxZS1lM2Y3LTQ3YjctYjgyMS00MzExMTEzOWUzMjUvIiwiaWF0IjoxNzE1NjIzOTAwLCJuYmYiOjE3MTU2MjM5MDAsImV4cCI6MTcxNTYyOTQyMCwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkFUUUF5LzhXQUFBQUFrcXNKNUNXV2RwbE1OK0pOS3FGa0NRcDRMK0NjaUJDTzF2eVpKUUVxbGt6WnRxRTVJ' -H 'Content-Type: application/json' -d '{
"startDateTime": "2024-05-14T09:00:00",
"endDateTime": "2024-05-14T10:00:00",
"subject": "Test Meeting"
}'
出现错误:
{“错误”:{“代码”:“禁止”,“消息”:“9024:引发了类型为“Microsoft.Skype.SkypeCast.SchedulerWebRole.BusinessLogic.Teams.Common.Exceptions.TeamsMeetingProcessorException”的异常。”,“ innerError":{"日期":"2024-05-13T18:20:35","请求 ID":"ce4a3ab1-c009-45d2-89ed-9fbbc21e241c","客户端请求 ID":"ce4a3ab1-c009 -45d2-89ed-9fbbc21e241c"}}}
这有什么问题吗?我该如何解决这个问题?
要解决该错误,请确保将 active Office 365 许可证分配给其中包含
Microsoft Teams
的用户帐户。
您可以按照此MS Document了解需要什么许可证以及如何获取它。获取许可证后,请确保将其分配给用户,如下所示:
现在,我通过使用具有有效 Office 365 许可证的用户登录来生成访问令牌,如下所示:
curl -X POST \
'https://login.microsoftonline.com/tenantId/oauth2/v2.0/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=appId' \
-d 'grant_type=authorization_code' \
-d 'scope=https://graph.microsoft.com/.default' \
-d 'code=code' \
-d 'redirect_uri=https://jwt.ms' \
-d 'client_secret=secret'
回复:
当我使用此令牌创建在线会议时,我成功收到如下响应:
curl -X POST https://graph.microsoft.com/v1.0/me/onlineMeetings -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' -d '{
"startDateTime":"2024-05-16T14:30:34.2444915-07:00",
"endDateTime":"2024-05-16T15:00:34.2464912-07:00",
"subject":"Test Meeting"
}'
回复:
参考: