Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
842 views
in Technique[技术] by (71.8m points)

rest - 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 (e.g. 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?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

enter image description here

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...