简体   繁体   中英

OneDrive API and Azure Active Directory setup to upload as personal account

I'll try to be as brief and comprehensive as I can.

Objective: To be able to upload PDF files generated after filling an HTML form to my personal OneDrive.

I have been looking into this for a few days now and cannot for the life of me figure out the proper way to set up the app and permissions in the Azure portal for this to work. I was initially using the Personal Microsoft accounts only option but quickly realized that would mean having to sign in. Then I tried the Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (eg Skype, Xbox) option. So this seemed to be a step in the right direction as the end-user does not need to do anything. I could use Application Permissions which would work without a signed-in user. That is basically what I want.

This lead to another issue, Tenant does not have a SPO license . After looking up more, it seems that to use the OneDrive APIs, you need to have a subscription. Like I mentioned, I am using a personal account (free).

I also tried daemon (since I can use application permissions and work without a user signed in). But based on the Microsoft Graph Get Files Permissions, Only Delegated permission is supported for personal Microsoft account.

I am trying to achieve this through PHP and using the libraries that are recommended everywhere. I honestly think that I am finding this much more complicated than it really is but I really can't figure out where I'm going wrong.

In conclusions, I can't answer these questions:

  1. Can a personal free account (with student subscription or not) be used to access OneDrive?
  2. If so, what supported account type is ideal for this?
  3. And finally, is there anywhere I can follow to do this?

PS I have tried a lot more things I mentioned here, so in case anyone thinks of something I should have done, ask me and I'll update you.

You have tried many and got many correct conclusions.

To make a personal account access the personal OneDrive, you have to use delegated permission. Application permission is not supported in this scene.

I know your requirement is not to sign in interactively. Unfortunately it's not supported to use ROPC flow for personal accounts.

在此处输入图像描述

So the only option is to use auth code flow or implicit grant flow . Both of them require you to sign in interactively.

In summary, uploading files to personal OneDrive using non-interactive login is not supported.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM