我使用客戶端ID和密碼進行身份驗證。Microsoft Graph API內容401未授權
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中的內容,它會在位置標題中返回另一個網址。但是,當我嘗試獲取該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 = ...「' 看起來好像你應該能夠訪問但不起作用。 – Alastair