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

feat(services/onedrive): Add read and write support for OneDrive #2129

Merged
merged 40 commits into from
Apr 28, 2023

Conversation

imWildCat
Copy link
Contributor

@imWildCat imWildCat commented Apr 26, 2023

To get a working access_token for OneDrive, we can leverage https://crates.io/crates/graph-rs-sdk, especially its demo: https://github.com/sreeise/graph-rs-sdk/tree/master/examples/oauth

This is the initial PR of R/W support of OneDrive. For uploading (Write), this PR only aims to support files under 4MB via the Simple Upload API.

Tentative plan after this PR:

core/Cargo.toml Outdated Show resolved Hide resolved
@imWildCat imWildCat changed the title Add read and write support for OneDrive feat(services/onedrive): Add read and write support for OneDrive Apr 26, 2023
core/src/services/onedrive/backend.rs Outdated Show resolved Hide resolved
core/src/services/onedrive/builder.rs Outdated Show resolved Hide resolved
core/src/services/onedrive/error.rs Show resolved Hide resolved
core/src/services/onedrive/writer.rs Outdated Show resolved Hide resolved
core/src/services/onedrive/builder.rs Show resolved Hide resolved
# Conflicts:
#	core/src/services/mod.rs
#	core/src/services/onedrive/backend.rs
#	core/src/services/onedrive/builder.rs
#	core/src/services/onedrive/mod.rs
#	core/src/services/onedrive/writer.rs
@imWildCat imWildCat marked this pull request as ready for review April 28, 2023 02:01
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@Xuanwo Xuanwo merged commit 69dd454 into apache:main Apr 28, 2023
@imWildCat
Copy link
Contributor Author

Thanks a lot!

Thank you, @Xuanwo @suyanhanx !

@Xuanwo Xuanwo mentioned this pull request May 6, 2023
@intgr
Copy link

intgr commented Jun 9, 2024

To get a working access_token for OneDrive, we can leverage https://crates.io/crates/graph-rs-sdk, especially its demo: https://github.com/sreeise/graph-rs-sdk/tree/master/examples/oauth

Wait, so how does one use that to get a working access token?

Pretty surprising that there is 0 documentation how to actually configure the OneDrive integration.

@imWildCat
Copy link
Contributor Author

imWildCat commented Jun 10, 2024

To get a working access_token for OneDrive, we can leverage https://crates.io/crates/graph-rs-sdk, especially its demo: https://github.com/sreeise/graph-rs-sdk/tree/master/examples/oauth

Wait, so how does one use that to get a working access token?

Pretty surprising that there is 0 documentation how to actually configure the OneDrive integration.

You should NOT be surprised. This is out of the scope of opendal.

If you'd like to check some tutorials, I did find a quick for you: https://www.youtube.com/watch?v=NljQx11YqNY

In general, OAuth flows for these big techs are pretty complex, sometimes replying on their own SDKs by default. I was working in MSFT. So I knew this very well. For example, if you'd like to use Graph API on iOS/macOS, you might want https://github.com/AzureAD/azure-activedirectory-library-for-objc
Why this flow is always complicated? Because they must respect users' privacy and also data compliance, like GDPR.
So it is always required something like "User Consent".

The goal of OpenDAL is just a light-weight wrapper of some data uploading / downloading apis. So this lib is not depending on any of these first-party SDKs provided by the service companies.

In my own company, I write these logic into Rust directly, referring to the sample code link I shared above. You'd better check them out before being surprised here.
This flow would be easier for you if you write them in Rust for all the other big ones, like Google and/or Dropbox.

@Xuanwo
Copy link
Member

Xuanwo commented Jun 10, 2024

To get a working access_token for OneDrive, we can leverage https://crates.io/crates/graph-rs-sdk, especially its demo: https://github.com/sreeise/graph-rs-sdk/tree/master/examples/oauth

Wait, so how does one use that to get a working access token?

Pretty surprising that there is 0 documentation how to actually configure the OneDrive integration.

Thanks for pointing out. Would you like to create an issue for this? It's better if we can improve this part.

@imWildCat
Copy link
Contributor Author

as I said, it is out of the scope of this project. So I don't think it is an issue of opendal

@Xuanwo
Copy link
Member

Xuanwo commented Jun 10, 2024

as I said, it is out of the scope of this project. So I don't think it is an issue of opendal

Yes, it's beyond the scope of this project. However, we can still provide some basic guidance or setup for our users.

We shouldn't say that it's none of OpenDAL's business and do nothing about it. It causes pain for our users. The best approach is to open an issue, bring this problem to a wider audience, and see if anyone is interested in contributing to this.

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

Successfully merging this pull request may close these issues.

4 participants