How to use the resource_owner grant within Microsoft365R

64 Views Asked by At

I'm trying to implement an unattended script accessing files within OneDrive using Microsoft365R. I've setup everything like in the docs using the default app registration.

The interactive flow with auth_type="device_code" works without issues:

odb <- Microsoft365R::get_business_onedrive(auth_type="device_code")

But when trying auth_type="resource_owner" like shown in the docs here, I get the following error:

odb <- Microsoft365R::get_business_onedrive(tenant=tenant, app=app, username=user, password=getPass(), auth_type="resource_owner")

Error in process_aad_response(res) : Bad Request (HTTP 400). Failed to obtain Azure Active Directory token. Message: AADSTS50126: Error validating credentials due to invalid username or password.

My guess is, that the default app is missing some privileges to use the "resource_owner" flow. Can someone point me to the right direction on how to get the resource_owner flow working?

(Using Service Principles is not a solution for my setup, but I did also try it with a dedicated service account and it was not working either)

0

There are 0 best solutions below