[英]How can I use an EWS token to fetch attachments from the Microsoft Graph API using a backend API?
I have an EWS token and attachment details as payload sent from an Outlook add-in.我有一个 EWS 令牌和附件详细信息作为从 Outlook 加载项发送的有效负载。 I am trying to use the Microsoft Graph API to fetch the content of the attachment in base64 format and save it in an AWS S3 Bucket.
我正在尝试使用 Microsoft Graph API 以 base64 格式获取附件的内容并将其保存在 AWS S3 存储桶中。
My plan is to use the following API endpoint:我的计划是使用以下 API 端点:
https://graph.microsoft.com/v1.0/me/messages/${itemId}/attachments` (/${attachmentId})
However, when I try to use the EWS token as the access token for this request, I get an "Access token validation failure. Invalid audience."但是,当我尝试使用 EWS 令牌作为此请求的访问令牌时,我收到“访问令牌验证失败。无效的受众”。 error.
错误。 How can I obtain a valid access token for this request and successfully fetch the attachments?
如何获得此请求的有效访问令牌并成功获取附件?
I tried using npm packages like node-ews and ews-javascript-api.我尝试使用 npm 包,如 node-ews 和 ews-javascript-api。
I tried using the above endpoint and token-exchange grant type too.
Alternate (better) methods are also welcomed.也欢迎使用替代(更好)方法。
EWS and Graph API are different technologies. EWS 和 Graph API 是不同的技术。 You can't use EWS token for accessing Graph API. To access data through Microsoft Graph, your application will need to acquire an OAuth 2.0 access token, and present it to Microsoft Graph in either of the following options:
您不能使用 EWS 令牌访问 Graph API。要通过 Microsoft Graph 访问数据,您的应用程序需要获取 OAuth 2.0 访问令牌,并通过以下任一选项将其提供给 Microsoft Graph:
Read more about that in the Best practices for working with Microsoft Graph article.在 使用 Microsoft Graph 的最佳实践一文中阅读更多相关信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.