gpt4 book ai didi

azure - 如何使用控制台应用程序通过 Microsoft Graph API 调用 Microsoft Teams OnlineMeeting 端点?

转载 作者:行者123 更新时间:2023-12-02 08:30:21 24 4
gpt4 key购买 nike

我已遵循以下 link 中给出的代码示例通过 Microsoft 并成功获取用户列表。

我在 Azure Active Directory 中注册的应用程序也具有“OnlineMeeting.ReadWrite.All”应用程序权限。

但是当我尝试通过在端点“https://graph.microsoft.com/v1.0/me/onlineMeetings”中发布请求来调用创建 session 调用时。我收到 403 禁止错误。知道我为什么会收到这个吗?

最佳答案

对于图形 API 创建在线 session https://graph.microsoft.com/v1.0/me/onlineMeetings,我们可以看到 tutorial显示它不支持“应用程序权限”来调用它。它只支持“委派权限”,因此我们只能通过密码授予流程请求它,而不能通过客户端凭据流程请求它。

enter image description here

更新:

对于您请求创建在线 session 的图形API的需求,我们可以只使用密码授予流程或授权码流程。这里提供了一个密码授予流程(用户名和密码)的示例供您引用,使用该示例获取 token 并通过该 token 请求图谱API。您还可以在 tutorial 中找到此示例。

static async Task GetATokenForGraph()
{
string authority = "https://login.microsoftonline.com/contoso.com";
string[] scopes = new string[] { "user.read" };
IPublicClientApplication app;
app = PublicClientApplicationBuilder.Create(clientId)
.WithAuthority(authority)
.Build();
var accounts = await app.GetAccountsAsync();

AuthenticationResult result = null;
if (accounts.Any())
{
result = await app.AcquireTokenSilent(scopes, accounts.FirstOrDefault())
.ExecuteAsync();
}
else
{
try
{
var securePassword = new SecureString();
foreach (char c in "dummy") // you should fetch the password
securePassword.AppendChar(c); // keystroke by keystroke

result = await app.AcquireTokenByUsernamePassword(scopes,
"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dbb1b4be9bb8b4b5afb4a8b4f5b8b4b6" rel="noreferrer noopener nofollow">[email protected]</a>",
securePassword)
.ExecuteAsync();
}
catch(MsalException)
{
// See details below
}
}
Console.WriteLine(result.Account.Username);
}

关于azure - 如何使用控制台应用程序通过 Microsoft Graph API 调用 Microsoft Teams OnlineMeeting 端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61394747/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com