Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onedrive - get files (shared with user/followed by user) #830

Open
ssmails opened this issue Feb 24, 2024 · 2 comments
Open

Onedrive - get files (shared with user/followed by user) #830

ssmails opened this issue Feb 24, 2024 · 2 comments
Labels

Comments

@ssmails
Copy link

ssmails commented Feb 24, 2024

Hello @vgrem @GitSumito , came across the issue #654

question on how to get the user_assertion for the below ?
msal_app.acquire_token_on_behalf_of(user_assertion=id_token,scopes=["https://graph.microsoft.com/.default"])

Per the below link, it seems it needs user interaction to get it. Is that correct?
https://github.com/Azure-Samples/ms-identity-python-on-behalf-of

Wondering if any way to get the files shared/followed by user for one drive, without user interaction ? Is this possible using the ConfidentialClientApplication with MSAL to get the token and use with these examples ?

app = msal.ConfidentialClientApplication(clientID, authority=authority, client_credential={"thumbprint": thumbprint, "private_key": cert}) 
    result = app.acquire_token_for_client(scopes=scope)

Can these examples be updated to support the use case of an app accessing users drive items / shared items - via msal ConfidentialClientApplication, if that is possible ?
https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/onedrive/drives/list_followed_items.py
https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/onedrive/drives/list_shared_with_me.py

@ssmails
Copy link
Author

ssmails commented Feb 25, 2024

When I try the ClientCredential Flow as documented https://github.com/vgrem/Office365-REST-Python-Client/tree/master?tab=readme-ov-file#working-with-onedrive-and-sharepoint-v2-apis ,

and use it for the example https://github.com/vgrem/Office365-REST-Python-Client/blob/master/examples/onedrive/drives/list_followed_items.py

I get an error - Is this use case supported with the client credential flow ? Since I plan to have this functionality in a daemon web application, I assume I need to use the client credential flow.

office365.runtime.client_request_exception.ClientRequestException: ('BadRequest', '/me request is only valid with delegated authentication flow.', '400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/me/drive/following')

If not, How do we configure the delegated authentication flow to use with this ? I am using a MS Azure App with attached permissions.

Screenshot 2024-02-25 at 12 06 47 PM

@ssmails
Copy link
Author

ssmails commented Feb 25, 2024

@vgrem Can you kindly help on this. Thanks.

@vgrem vgrem added the question label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants