2015-07-28 26 views
0

我已按照此鏈接https://msdn.microsoft.com/en-us/office/office365/howto/building-service-apps-in-office-365至 在Office365中設置守護程序或服務器應用程序爲Web API身份驗證方法以獲取訪問令牌。下面在身份驗證辦公室中不支持的應用程序唯一令牌問題

POST https://login.microsoftonline.com/{tenant-id}/oauth2/token 
grant_type : client_credentials 
client_id : {clientId} 
client_secret : {clientSecret} 
resource : https://{tenant}.sharepoint.com 

樣品接入令牌請求中給出例如:

https://login.microsoftonline.com/cae788bd-7a55-4fb5-9d1f-3aa5365e14a/oauth2/token 
grant_type : client_credentials 
client_id : 1dd0a211-06f1-4f6a-a232-b3a8dcab829b 
client_secret : ZWtkWm9M5Ucx5j29UoXPy7GKG+Hu0eNdVFYO+lH761w= 
resource : https://{tenant}.sharepoint.com 

從上面的API請求,我正在訪問令牌,當我試圖創建該文件夾或訪問來自上述訪問令牌的任何其他api,則 顯示錯誤爲「不支持的應用程序唯一令牌」。我試圖調用這個Web服務來得到這個錯誤:

PUT https://{tenant}.sharepoint.com/_api/v1.0/Files/{parent-id}/children/{folder-name} 
Authorization : BearerBearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE 
Content-Type : application/json 
Accept : application/json 

而在此前,我們已經使用了相同的守護程序或服務器應用程序的Office365的Web API認證方法來獲得訪問令牌,它是工作的罰款。

我們使用accesstoken訪問Office 365 API,但現在它顯示錯誤爲「不支持的應用程序唯一標記」。

+0

你有沒有想出解決辦法?你的解決方案是什麼? – teachtyler

回答

0

馬諾,

我得到了應用程序,只在WPF應用程序的郵件API的工作,你有沒有安裝證書? 按照博客你提到

Because of the broad access these kinds of apps enjoy, there is an additional requirement for the app to successfully obtain an access token. Instead of using a client ID and client secret, the app must use an X.509 certificate with a public/private key pair.

請參閱此鏈接如何設置它: Performing app-only operations on SharePoint Online through Azure AD