首页 文章

使用Microsoft graph api读取OneDrive文件

提问于
浏览
1

我'm trying to access my OneDrive (personal account) files using the Microsoft Graph API but I can' t让它工作 . 我已经阅读了几天,但没有运气 . 我正在使用“Client Credentials Flow ". I have created an application in the Application Registration Portal and I have set application permissions. It works fine to get a token but when I try to read the root of OneDrive using this token it says "访问被拒绝", "要么scp或角色声明需要出现在令牌中 . ”当我使用v2.0版本获取令牌然后使用v1.0版本访问OneDrive时会发生这种情况 . 即我使用此URL获取令牌:https://login.microsoftonline.com/common/oauth2/v2.0/token和此URL以获取OneDrive根:https://graph.microsoft.com/v1.0/drive/root?$ expand =缩略图,子($ expand =缩略图)

当我执行“Authorization Code Flow”时它工作正常 .

可能是什么问题?

1 回答

  • 1

    对于个人帐户和与个人帐户相关的数据(如个人OneDrive),仅支持委派(授权代码流) . 此处不支持客户端凭据流 . 客户端凭据流仅支持商业(Azure AD)方案 .

    您是否考虑过为什么需要针对个人OneDrive使用客户端凭据流(与授权代码流相比)?

    希望这可以帮助,

相关问题