2016-07-15 158 views
0

嗨,我嘗試使用管理活動API來開發本地客戶端應用程序,我嘗試使用以下POST請求訂閱Office 365的管理活動API授權

https://manage.office.com/api/v1.0/8bee0d59-7cb7-499f-aa59-8b6990061a96/activity/feed/subscriptions/start?contentType=Audit.AzureActiveDirectory

並獲得以下錯誤 {「消息」 :「授權已被拒絕了這個請求。」}

在此之前,我做了驗證,並能夠生成訪問令牌和使用從訪問檢索到的tenantid token.Could請人提供的示例代碼或讓我知道怎麼去訂閱甚至提到了毫秒dn文檔,但找不到解決方案

回答

0

您是如何獲取訪問令牌的?如果我使用其他資源的令牌(Office 365或Microsoft Graph等)調用Office 365管理REST API,我只能重現此問題。

您可以參考下面的請求以獲取Office 365管理REST令牌API(授權碼授權流程)。

第1步:獲取授權碼

Get: https://login.windows.net/common/oauth2/authorize?response_type=code&resource=https%3A%2F%2Fmanage.office.com&client_id={clientId}&redirect_uri={RedirectUrl} 

步驟2:請求有關的進展情況,以獲得令牌的訪問令牌

POST: https://login.windows.net/common/oauth2/token 
resource=https%3A%2F%2Fmanage.office.com&client_id={clientId}&redirect_uri={redirectUrl}&client_secret={clientSecret(if it is a confident app)}&grant_type=authorization_code&code={AuthCode} 

更多細節,可以參考here