【发布时间】:2019-11-26 21:09:19
【问题描述】:
我正在使用 graph rest api 来编写草稿邮件。
首先,我用https://graph.microsoft.com/.default范围调用了authorize方法:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=MY_CLIENT_ID&response_type=code&redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient&response_mode=query&scope=https://graph.microsoft.com/.default
用得到的代码,我调用了同样作用域的token方法:
https://login.microsoftonline.com/common/oauth2/v2.0/token
使用此令牌,我可以毫无问题地获取消息,但是当我尝试通过调用:https://graph.microsoft.com/v1.0/me/messages/ 创建草稿时,我收到以下错误:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "7fafbb5a-ab6d-4dbc-bb73-69d58b00f7ac",
"date": "2019-11-26T20:48:24"
}
}
}
如文档 (https://docs.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http) 中所述,我已在我注册的 Azure 应用程序中设置了 Mail.ReadWrite 权限并获得管理员同意。我错过了什么吗?
【问题讨论】: