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 摘要。