首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >InvalidAuthenticationToken错误:使用office365规划器任务API时

InvalidAuthenticationToken错误:使用office365规划器任务API时
EN

Stack Overflow用户
提问于 2016-05-16 18:33:46
回答 2查看 6.4K关注 0票数 1

我正在尝试使用Microsoft Graph API获取我的office365规划器任务,但我得到了以下错误:

获取https://graph.microsoft.com/beta/me/tasks

代码语言:javascript
运行
复制
{
  "error": {
    "code": "InvalidAuthenticationToken",
    "message": "Bearer access token is empty.",
    "innerError": {
      "request-id": "4f209643-f3f6-4256-87b7-cf4f2fd489eb",
      "date": "2016-05-16T09:03:33"
    }
  }
}
EN

回答 2

Stack Overflow用户

发布于 2016-05-17 10:26:21

错误消息非常简单明了,

"message":“持有者访问令牌为空。”

在进行此RESTful接口调用之前,您需要进行身份验证。

如果您正在开发自己的应用程序,请按照本教程了解OAuth2工作流http://graph.microsoft.io/en-us/docs/platform/rest

如果您正在使用Graph Explore,请确保在调用该接口之前已登录。

票数 3
EN

Stack Overflow用户

发布于 2016-12-09 22:42:09

我使用此控制器的操作代码来授予管理员同意:

代码语言:javascript
运行
复制
//<Summary>
    //Used to grant admin consent to Azure AD apps
    //</Summary>
    public virtual ActionResult AdminConsentApp()
    {
        string strResource = "https://graph.microsoft.com";
        string strRedirectController = "https://localhost:[my local debug port number]";

        string authorizationRequest = String.Format(
            "https://login.windows.net/common/oauth2/authorize?response_type=code&client_id={0}&resource={1}&redirect_uri={2}&prompt={3}",
                Uri.EscapeDataString(SettingsHelper.ClientId),
                Uri.EscapeDataString(strResource),
                Uri.EscapeDataString(String.Format("{0}", strRedirectController)),
                Uri.EscapeDataString("admin_consent")
                );

        return new RedirectResult(authorizationRequest);
    }

希望这能帮上忙,干杯,丹佛

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37251828

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档