0
votes

I have created a web app which is making use of OneDrive API (https://docs.microsoft.com/en-us/onedrive/developer/rest-api/) to perform actions such as create/update/rename/delete of documents etc. I am authorizing requests with OAuth 2.0 (client side - that means every access token is valid for ~1h and then silently I am getting a new token) and then perform previous actions using that token.

I have a new requirement for the authorized user to share his/her documents for writing/updating them (I found out that API has option for inserting permissions (https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite).

Is it possible for a non-authenticated user to be able to write/update documents (programmatically - via OneDrive API or some other API?) that have been created from the authenticated user that shared these? (something that is similar to Microsoft Word online when a user is sharing his document and offline/ guest users are able to edit it?

Thanks.

1

1 Answers

0
votes

Some Update: First of all documentation for REST API/ endpoints is chaotic. (https://github.com/OneDrive/onedrive-api-docs/issues/839)

I found out that I can get shared document via these endpoints:

GET: https://api.onedrive.com/v1.0/shares/encodedUrl/driveItem

And update shared document only if I have an access token PUT: https://api.onedrive.com/v1.0/shares/encodedUrl/driveItem/content?access_token=accessToken

where encodedUrl can be obtained as : https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/shares_get (check example on C# with sharing url )

So, I am still wondering how possible is to update a document without any authentication but just a share url.