Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Question about OneDrive Storager implement #11

Closed
zxy-lgtm opened this issue Aug 10, 2021 · 11 comments
Closed

Question about OneDrive Storager implement #11

zxy-lgtm opened this issue Aug 10, 2021 · 11 comments

Comments

@zxy-lgtm
Copy link
Member

zxy-lgtm commented Aug 10, 2021

  1. authorization
    Because onedrive uses oauth authentication, an OAuth instance is required to obtain accesstoken. Do we have to do this built-in? My current test environment uses the example of Microsoft Graph Explorer.
    If we need to do a built-in authentication process, I think maybe our credential field should be env, which contains similar clientid, clientsecret...

  2. abstract objectID to path
    Because the current SDKs are all developed according to OneDrive's development manual. Onedrive's API objects are basically based on objectID, instead of locating a storage object through the traditional path.
    So I think there are two ways to achieve path abstraction.

    1. Through the search API, putting the search pressure on the onedrive side, but it seems that Microsoft's bug has not been fixed.
    2. Through the given path, traverse each folder to find the target file, but this is more expensive. The only way to think at present is to cache, cache the already known objectid, and check before the operation to ensure consistency.
@xxchan
Copy link

xxchan commented Aug 10, 2021

question 1: see beyondstorage/go-service-gdrive#17

question 2:

I found that OneDrive do support file path: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/resources/driveitem?view=odsp-graph-online (If I understand incorrectly, please tell me)

There are two primary ways of addressing a driveItem resource:

By the driveItem unique identifier using drive/items/{item-id}
By file system path using /drive/root:/path/to/file

And take a look at this similar issue beyondstorage/go-service-gdrive#11

@Xuanwo Xuanwo changed the title issue-path Question about OneDrive Storager implement Aug 10, 2021
@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 10, 2021

See go-service-gdrive RFC-14 for more info: https://github.com/beyondstorage/go-service-gdrive/blob/master/docs/rfcs/14-gdrive-for-go-storage-design.md

GitHub
Google Drive support for go-storage. Contribute to beyondstorage/go-service-gdrive development by creating an account on GitHub.

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 13, 2021

Hello, @zxy-lgtm , Is there anything else we can help you with?

@zxy-lgtm
Copy link
Member Author

你好,@zxy-lgtm,还有什么我们可以帮助你的吗?

In recent days, I modified the SDK to use path instead of ID function. Recently, because onedri only uses oauth2, I am adding OAuth2 support to it.

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 13, 2021

In recent days, I modified the SDK to use path instead of ID function. Recently, because onedri only uses oauth2, I am adding OAuth2 support to it.

Maybe we can start a draft PR so that @xxchan can give some advice?

@zxy-lgtm
Copy link
Member Author

zxy-lgtm commented Aug 13, 2021

你好,@zxy-lgtm,还有什么我们可以帮助你的吗?

In recent days, I modified the SDK to use path instead of ID function. Recently, because onedri only uses oauth2, I am adding OAuth2 support to it.

Because I haven't learned oauth2, I'm learning the official onedrive documentation recently:https://docs.microsoft.com/en-us/graph/auth/auth-concepts

To call Microsoft Graph, your app must acquire an access token from the Microsoft identity platform.

@zxy-lgtm
Copy link
Member Author

I also saw the implementation of GDrive

@zxy-lgtm
Copy link
Member Author

zxy-lgtm commented Aug 13, 2021

In recent days, I modified the SDK to use path instead of ID function. Recently, because onedri only uses oauth2, I am adding OAuth2 support to it.

Maybe we can start a draft PR so that @xxchan can give some advice?

question 1: see beyondstorage/go-service-gdrive#17

question 2:

I found that OneDrive do support file path: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/resources/driveitem?view=odsp-graph-online (If I understand incorrectly, please tell me)

There are two primary ways of addressing a driveItem resource:
By the driveItem unique identifier using drive/items/{item-id}
By file system path using /drive/root:/path/to/file

And take a look at this similar issue beyondstorage/go-service-gdrive#11

thanks,but in the method delete does not useful there only have /me/drive/items/{item-id}
and also in upload the method put PUT /me/drive/items/{item-id}/content when you want to replace an existing item
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online

@zxy-lgtm
Copy link
Member Author

zxy-lgtm commented Aug 13, 2021

In recent days, I modified the SDK to use path instead of ID function. Recently, because onedri only uses oauth2, I am adding OAuth2 support to it.

Maybe we can start a draft PR so that @xxchan can give some advice?

question 1: see beyondstorage/go-service-gdrive#17
question 2:
I found that OneDrive do support file path: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/resources/driveitem?view=odsp-graph-online (If I understand incorrectly, please tell me)

There are two primary ways of addressing a driveItem resource:
By the driveItem unique identifier using drive/items/{item-id}
By file system path using /drive/root:/path/to/file

And take a look at this similar issue beyondstorage/go-service-gdrive#11

thanks,but in the method delete does not useful there only have /me/drive/items/{item-id}
and also in upload the method put PUT /me/drive/items/{item-id}/content when you want to replace an existing item
https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online

DriveItem - OneDrive API - OneDrive dev center

Upload small files - OneDrive API - OneDrive dev center

but I test and find PUT /me/drive/root:/path:/content and DELETE /me/drive/root:/path: can solve them successfully

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 13, 2021

but I test and find PUT /me/drive/root:/path:/content and DELETE /me/drive/root:/path: can solve them successfully

Looks cool.

zxy-lgtm added a commit to zxy-lgtm/go-service-onedrive that referenced this issue Aug 13, 2021
zxy-lgtm added a commit to zxy-lgtm/go-service-onedrive that referenced this issue Aug 13, 2021
@Xuanwo
Copy link
Contributor

Xuanwo commented Sep 22, 2021

Moved to https://forum.beyondstorage.io/t/topic/240

BeyondStorage
authorization Because onedrive uses oauth authentication, an OAuth instance is required to obtain accesstoken. Do we have to do this built-in? My current test environment uses the example of Microsoft Graph Explorer. If we need to do a built-in authentication process, I think maybe our credential field should be env, which contains similar clientid, clientsecret… abstract objectID to path Because the current SDKs are all developed according to OneDrive’s development manual. Onedrive’s AP...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants