【发布时间】:2017-05-05 22:20:33
【问题描述】:
我正在使用客户端 ID 和密码进行身份验证。
String url = String.format("https://login.microsoftonline.com/%s/oauth2/token", tenantContext);
AuthenticationContext context = new AuthenticationContext(url, true, ForkJoinPool.commonPool());
AuthenticationResult result = context.acquireToken("https://graph.microsoft.com", new ClientCredential(clientId, clientSecret), null).get();
String token = result.getAccessTokenType() + " " + result.getAccessToken();
我的应用程序已勾选所有权限框,并且使用上述令牌,我可以列出用户并遍历他们的驱动器和文件夹。我可以访问内容 https://graph.microsoft.com/v1.0/drives/%s/items/%s/content 在 Location 标头中返回另一个 URL。但是,当我尝试获取该 URL 时,它会返回 401 Unauthorized。
【问题讨论】:
-
或者,项目 json 包含一个格式为:
"@microsoft.graph.downloadUrl": "https://{tenant}-my.sharepoint.com/personal/{user}_{tenant}_onmicrosoft_com/_layouts/15/download.aspx?UniqueId=...&access_token=...&prooftoken=..."的字段,看起来您应该能够访问,但这也不起作用。