microsoftgraph / microsoftgraph/msgraph-sdk-java

Guest User Receives 401 "accessDenied" Error When Accessing Shared Files via Microsoft Graph API Despite Valid Authentication

未關閉
#2,518 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

status:waiting-for-triage
主要語言
Java
星號
444
分支
154
平均合併
18 小時 28 分鐘
30 天內合併 PR
4

描述

Refernce similar to this in Sharepoint: https://github.com/OneDrive/onedrive-api-docs/issues/1039

Pattern of failure:
Initial API calls fail with 401
After manually visiting the file through SharePoint web UI, API calls work temporarily (1-4 hours)
API calls then fail again after a period of inactivity
Web UI access requires device code authentication flow
What works:
✅ Basic Microsoft Graph calls (/me) succeed
✅ Accessing files through SharePoint web UI works
✅ Token refresh succeeds and produces valid access tokens
What fails:
❌ Microsoft Graph API calls to /shares/{share-id}/driveItem

Issue Type: Microsoft Graph API Authentication
Affected Service: SharePoint Online for Business
User Type: Guest User (External/Cross-Tenant)
Authentication Method: OAuth 2.0 with Refresh Token
API Endpoint: /shares/{share-id}/driveItem

Problem Description:
As a guest user in your tenant, I am unable to programmatically access shared files via the Microsoft Graph API, despite having:

Valid authentication tokens
Proper API permissions granted
Ability to access the same files through the web UI

Detailed Symptoms:

API calls fail with 401 error:

{
"error": {
"code": "accessDenied",
"message": "There has been an error authenticating the request."
}
}

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

未指定來源檔案或測試。首先使用來賓使用者重新整理後的 token 重現 /shares/{share-id}/driveItem 請求,然後將其與 /me 以及 SharePoint Web UI 的存取進行比較,並以連結的 SharePoint issue 作為內容。完成的要求是:針對反覆出現的 401 回應,記錄其原因並驗證解決方案。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
api, authentication, cloud
Issue 類型
缺陷
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
20/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。