0

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.

How can I use single-tenant specific endpoint? I want to create a file picker that permit user to browse its file and organization files. I already read this question but, without editing OneDrive.js (library), I can't change

https://login.microsoftonline.com/common

to

https://login.microsoftonline.com/MY_TENANT_NAME

Hope you can help me, thanks.

Community
  • 1
  • 1

1 Answers1

1

because the onedrive.js library has the common endpoint hard coded, your easiest way is to change it to point to your tenant login endpoint.

if you don't want to do that, have the user login before using the picker, then save the access token and endpoint and provide it to the js similar to whats being done here: https://github.com/OneDrive/onedrive-explorer-js/blob/master/index.html

as per https://docs.microsoft.com/en-us/onedrive/developer/controls/file-pickers/js-v72/open-file?view=odsp-graph-online#advanced-options the advanced options of the picker gives you options to specify the endpointhint and accesstoken.

hope that helps,

Update I just tried it this way and it seems to work. but I didn't try to do it with a token. just an endpointHint, when I used an endpointHint, it didn't give me the error about the multi-tenant issue.

<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.

alphaz18
  • 2,309
  • 1
  • 3
  • 4
  • Hi, thanks for the answer. I already have access token of logged user, but I don't know what I have to put in `endpointHint` – Davide Conte May 19 '20 at 07:34
  • if you want to browse the users onedrive for business account, since they are part of a tenant, then they must have onedrive for business, then the endpoint hint would be something like https:// orgtenant-my.sharepoint.com/personal/username_tenantdomain/ So Eg. say tenant name is corpabc and user is john@corpabc.com, it would be https:// corpabc-my.sharepoint.com/personal/john_corpabc_com – alphaz18 May 19 '20 at 14:01
  • With your instructions the result was the following: [image](https://i.imgur.com/sZSOuDx.png) – Davide Conte May 19 '20 at 14:45
  • i just added a test i did. – alphaz18 May 19 '20 at 22:45
  • It does work, but I can't choose files. https://i.imgur.com/7WxfyiZ.png The pop-up windows is not a file picker, only a file browser. – Davide Conte May 22 '20 at 10:02