簡體   English   中英

Office365 API:僅適用於應用的OAuth2 AccessToken要求

[英]Office365 API: OAuth2 AccessTokens for app-only require that the

我正在使用以下URL創建對Outlook Push Notification的訂閱請求:

https://outlook.office365.com/api/v2.0/me/subscriptions

我已經使用Azure AD使用基於證書的身份驗證來使用以下代碼獲取令牌:

AuthenticationContext authContext = new AuthenticationContext("https://login.microsoftonline.com/mytenant/oauth2/v2.0/token");
AuthenticationResult authResult = await authContext.AcquireTokenAsync("https://outlook.office365.com/", certificate);

調用訂閱API時,出現以下響應,出現禁止錯誤:

x-ms-diagnostics: 2000008;reason="OAuth2 AccessTokens for app-only require that the target mailbox is explicitly specified with the api call";error_category="invalid_grant"

您能幫我解決我要去的地方或如何調試/解決此錯誤。

提前致謝

由於您使用App-only令牌,因此API要求您在URI中顯式指定目標郵箱。 例如: https://outlook.office365.com/api/v2.0/Users(foo@bar.com)/subscriptionshttps://outlook.office365.com/api/v2.0/Users(foo@bar.com)/subscriptions foo@bar.com)/ https://outlook.office365.com/api/v2.0/Users(foo@bar.com)/subscriptions

僅當目標郵箱與經過身份驗證的用戶相同時, me才有用。 但是,在僅應用程序的情況下,沒有經過身份驗證的用戶,您必須明確。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM