我正在尝试使用Microsoft Graph API获取我的office365规划器任务,但我得到了以下错误:
获取https://graph.microsoft.com/beta/me/tasks
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Bearer access token is empty.",
"innerError": {
"request-id": "4f209643-f3f6-4256-87b7-cf4f2fd489eb",
"date": "2016-05-16T09:03:33"
}
}
}
发布于 2016-05-17 10:26:21
错误消息非常简单明了,
"message":“持有者访问令牌为空。”
在进行此RESTful接口调用之前,您需要进行身份验证。
如果您正在开发自己的应用程序,请按照本教程了解OAuth2工作流http://graph.microsoft.io/en-us/docs/platform/rest
如果您正在使用Graph Explore,请确保在调用该接口之前已登录。
发布于 2016-12-09 22:42:09
我使用此控制器的操作代码来授予管理员同意:
//<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);
}
希望这能帮上忙,干杯,丹佛
https://stackoverflow.com/questions/37251828
复制相似问题