OneDrive / samples

Contains samples, scenarios, and guidance for integrating with OneDrive and SharePoint drives, drive items, and files.
MIT License
58 stars 59 forks source link

How to get base url for personal accounts - picker v8 #43

Closed oreoluwa-bs closed 1 year ago

oreoluwa-bs commented 1 year ago

Hello,

Describe the bug With reference to this #21 could not get the web url from the https://graph.microsoft.com/v1.0/me/drive but I found it in https://graph.microsoft.com/v1.0/me/drive/root. The web url gotten from this endpoint for a business account is "{tenant}.sharepoint.com" but for personal accounts it is https://onedrive.live.com/?cid=xxxxx.

The issue is when the base url is combined with "_layouts/15/FilePicker.aspx" personal accounts return an item not found view, for business account it seems to work fine

To Reproduce

Expected behavior Expected a picker screen for personal one drive accounts instead received item not found.

Screenshots

Screenshot 2023-04-12 at 11 25 01

Details I am trying to create a space where users can open their one drive and share links to files with me via the file picker v8

Thank you.

patrick-rodgers commented 1 year ago

The base URL for the consumer picker is https://onedrive.live.com/picker. It is shown in this sample but looks like it is missing from the main docs page, will get that updated.

oreoluwa-bs commented 1 year ago

Thank you

ashundefined commented 1 year ago

@patrick-rodgers if i understand correctly we need two distinct URLs for the picker, https://onedrive.live.com/picker for personal accounts and https://<tenant-name>.sharepoint.com/_layouts/15/FilePicker.aspx for organizational accounts. I dug deep in the docs but I could not figure out a way of knowing wether or not an account is a personal or organizational account after triggering the login with msal-browser. Also the samples don't seem to cover that issue (unless I missed something). How can we, using msal-browser, figure out if an account is personal or organizational? And how can we retrieve the tenant name using msal-browser?