I've a microsoft business account and want to store in it uploaded users files. My goal is that the users of my PHP app can manage files, upload files, create folders etc to a oneDrive for business. it can be possible?
I've registered the php app with de microsoft business account and i have the client id and secret.
for example: client_id: 'XXXX'
Now im testing with my personal account. I'm getting an access token using the secret and client id of the business account and I authenticate with my personal microsoft account.
The steps I'm using to authenticated are:
GET https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
state=YYYY
&scope=openid+profile+directory.readwrite.all+files.readwrite.all
&response_type=code
&approval_prompt=auto
&client_id=XXXX
&redirect_uri=http%3A%2F%2Flocalhost%2Ftest
at this point Microsoft prompt a user login form, I authenticated with my personal account.
in the redirect uri I get de code and send a POST request to get the access token.
Now, at this point and with the access token, Can users (in this case me) access to the onedrive for business files/folders...etc? how? Which endpoint I have to use?
for example for accesing the drive:
https://graph.microsoft.com/v1.0/me/drive/root/children
the me parameter is the personal account or the bussiness acount drive?
I'm using this libraries to achieve my goal:
to connect users account to Microsoft Graph Auth2 => https://github.com/microsoftgraph/php-connect-rest-sample
request api resource https://github.com/microsoftgraph/msgraph-sdk-php/wiki/Example-calls