簡體   English   中英

OneDrive SDK:如何使用單租戶應用程序訪問 onedrive 文件?

[英]OneDrive SDK : how can I use single tenant app to access onedrive files?

AADSTS50194: Application 'censured'(-app) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.

如何使用單租戶特定端點? 我想創建一個允許用戶瀏覽其文件和組織文件的文件選擇器。 我已經閱讀了這個問題,但是如果不編輯 OneDrive.js(庫),我無法更改

https://login.microsoftonline.com/common

https://login.microsoftonline.com/MY_TENANT_NAME

希望你能幫助我,謝謝。

因為 onedrive.js 庫具有硬編碼的公共端點,您最簡單的方法是將其更改為指向您的租戶登錄端點。

如果您不想這樣做,請在使用選擇器之前讓用戶登錄,然后保存訪問令牌和端點並將其提供給 js,類似於此處所做的操作: https://github.com/OneDrive/onedrive -explorer-js/blob/master/index.html

根據https://docs.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/open-file?view=odsp-graph-online#advanced-options的高級選項選擇器為您提供指定端點提示和訪問令牌的選項。

希望有幫助,

更新我剛剛嘗試過這種方式,它似乎有效。 但我沒有嘗試用令牌來做。 只是一個端點提示,當我使用端點提示時,它沒有給我關於多租戶問題的錯誤。

<html>
<head>
<script type="text/javascript" src="https://js.live.net/v7.2/OneDrive.js"></script>
<script type="text/javascript">
  function launchOneDrivePicker(){
    var odOptions = {   
clientId: "myappid-guid-thing",
  action: "query",
  multiSelect: true,
  advanced: {endpointHint: "https://azuretenant-my.sharepoint.com/",},
  };
    OneDrive.open(odOptions);
  }
</script>
</head>
<body>
<button onClick="launchOneDrivePicker()">Open from OneDrive</button>
</body>
</html>

Please make sure you get the endpoint url right, eg, https://tenantname-my.sharepoint.com notice the "-my" after your tenant name, that's necessary.

暫無
暫無

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

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