Microsoft Graph API / Office Planner数据的权限访问令牌

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

我尝试通过Microsoft Graph API请求所有用户的所有Office Planner计划和任务。这是一个控制台应用程序,应该作为Azure WebJob运行。我正在努力使用Access Token。使用用户令牌,我在https://graph.microsoft.com/beta/users/ {userid} / plans上收到403(Forbidden)。

AuthenticationContext authenticationContext = new AuthenticationContext($"https://login.microsoftonline.com/{TenantName}", false);
var authTask = authenticationContext.AcquireTokenAsync("https://graph.microsoft.com", _config.ClientIdUser, new UserPasswordCredential(_config.Username, _config.Password));
uthTask.Wait();
AuthenticationResult userAuthnResult = authTask.Result;
var token = userAuthnResult.AccessToken;

使用仅限应用访问令牌,我无法请求图谱API。我在某处读过我必须使用app +用户令牌,但我该如何申请这样的令牌呢?

office365api microsoft-graph
1个回答
0
投票

您只能从交互式应用程序中首先请求app +用户令牌,用户可以在该应用程序中同意并以Microsoft拥有的用户体验提供其凭据。作为OAUTH流程的一部分,您可以请求刷新令牌,您可以安全地存储该令牌并传递给您的webjob以运行后续任务。

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