0
votes

I have a Personal OneDrive Account Purchased (not Free Tier).

What am I trying to do ?

To write a Daemon in Python that will connect to OneDrive Personal Account Folders and upload / show contents.

What did I tried doing ?

I learned Microsoft Graph is the way to go to access all personal business accounts.

  • So I signed in with Azure (Free) Portal with my OneDrive Credentials [email protected] , after signing in it created a Azure Default Directory with [email protected] as principal user.

  • Followed Tutorial and created App under App Registration granted it all the Permissions and Also admin Consent through the portal and generated Client Secret and Downloaded the sample code from QuickStart under Portal->Azure Directory-> App Reg..

  • Ran it on my computer with just one change in the code. After getting the Access Token , I changed the Graph Endpoint to /me/drives/root and I got a "Tenant does not have SPO License" , also I noticed when I change the graph endpoint to /users it yields me [email protected] as principal account name. When I expect [email protected]

  • So in graph Explorer I tried and it yields me proper principal account name as [email protected] also lists all the onedrive personal files as expected.

Problem ?

I cannot authenticate myself properly , since my application will be a Daemon I can't present myself a Login Page with redirect URLs so "Code Flow" type of Acquiring Authentication Token for Personal Accounts will not work for me as mentioned in the Tutorials.

Also if I forcefully query /me it says "Please use consumer endpoint" if I change the Authentication Endpoint it says invalid Client ID and Credentials (Because I think that onmicrosoft.com principal name cannot be used to query OneDrive Personal which belongs to [email protected] )

What do I request ?

An idea of how would others implement this daemon with brief if not detailed steps of configuration in Azure and Code , if possible a Sample code and an Algorithm.

I am new bla bla....hehe , actually I am new to Azure and is also using OAuth First Time. Thanks in advance. I will edit the question if someone needs more information on this to help me.

1
Hi do you have a chance to look into my answer? Anything else is unclear?Allen Wu

1 Answers

2
votes

You cannot use daemon to access personal account OneDrive files.

Daemon app will use Application permission (without user) to do the operation.

But based on the Microsoft Graph Get Files Permissions, Only Delegated permission is supported for personal Microsoft account. And Delegated Permission means app + user permission.

enter image description here

Currently you have to implement Get access on behalf of a user and use auth code flow to access personal account OneDrive files with Microsoft Graph API.