我正在为outlook,前端角度,后端Web API编写一个应用程序。我在前端使用adal成功获取访问令牌,sessionStorage是:
adal.access.token.keyxxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09:"Access-token"
adal.error:""
adal.error.description:""
adal.expiration.key:"0"
adal.expiration.keyxxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09:"1482073764"
adal.idtoken:"access-token"
adal.login.error:""
adal.login.request:"http://localhost:8080/"
adal.nonce.idtoken:"xxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09"
adal.session.state:"86xxxxxd-xxxx-480b-xxxx-34923xxxx918"
adal.state.login:"9axxxxxx-xxxx-xxxx-xxxx-360xxxxxx94"
adal.token.keys:"xxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09|"
adal.token.renew.statusxxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09:"Completed"现在我正在向后端发送access-token,我想从outlook API获取消息,但是我该怎么做呢?已搜索outlook REST api,并使用POSTMAN进行了测试,但无法正常工作。(401错误)
Get https://outlook.office.com/api/v2.0/me/messages
Authorization: Bearer access-token
Accept: application/json对如何做到这一点有什么建议吗?提前谢谢。
发布于 2016-12-20 03:22:54
看起来您正在尝试完成代表流程。在这里,前端API获取对中间层服务的访问令牌,中间层服务随后获取对后端API的访问令牌。让我们假设从前端到中间层的令牌具有用户上下文。通过使用原始访问令牌请求新的访问令牌,您可以使用相同的用户上下文从中间层获取令牌到后端。
以下是有关流程的更多详细信息:查找标题为Delegated User Identity with OAuth 2.0 On-Behalf-Of Draft Specification的部分
以下是集成此流程的代码示例:https://github.com/Azure-Samples/active-directory-dotnet-webapi-onbehalfof
只需注意,在此特定情况下,401错误意味着您没有调用和访问所需API的正确权限。您是否可以确保为要访问的资源以及访问该资源的客户端选择了正确的权限?
我希望这就是你要找的东西!
https://stackoverflow.com/questions/41209768
复制相似问题