Skip to content

Onedrive #721

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Onedrive #721

wants to merge 4 commits into from

Conversation

apaes
Copy link

@apaes apaes commented Jul 21, 2021

This is my "amateur" try at implementing OneDrive backend for organice. Some requirements to make this work:

  1. Decide who will be allowed to authenticate against the application (single-tenant, multi-tenant, multi-tenant + personal accounts, personal accounts only)
  2. Register an application with Microsoft (in my case I've done it through my free Azure account)
  3. Add a Single Page Application client to your registered APP and specify some redirect URIs, in my case:
    3.1) http://localhost:3000/blank.html
    3.2) https://somedomain/blank.html
  4. Copy the CLIENT-ID info of the registered application and use it in your .env file as REACT_APP_ONEDRIVE_CLIENT_ID
  5. copy the TENANT ID (in case of single-tenant) or one of the terms "organization", "common", "consumer" depending on the authentication scenario in (1) and update REACT_APP_ONEDRIVE_TENANT_ID on your .env file

Other notes:

a) I've added dependency of MS authentication library - @azure/ms-browser
b) I've added onedrive.js to /sync_backends to (implement some sign-in functionality, etc.) and onedrive_sync_backend_client.js
c) added public/blank.html for the OneDrive login redirect process
d) Microsoft supports 2 authentication methods (through window popup and page redirect) but due to lack of knowledge on how to implement additional URIs in organice I decided to rely solely on PopUp auth. This means popups will need to be enabled for this APP

Best,
Alex

Copy link
Collaborator

@schoettl schoettl left a comment

Choose a reason for hiding this comment

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

I just had a short look on your changes. Maybe you can install prettier in your IDE to stick to Organice' indentation style. Otherwise, the automatic formatting can also be done in a separate commit later...

Would be really cool, if we had an additional cloud option!

@@ -107,7 +110,7 @@ function GoogleDriveNote() {
</a>{' '}
on running your own instance of organice with Google Drive enabled.
<p>
If you don't want to do that, you are welcome to use Dropbox or WebDAV as synchronisation
If you dont want to do that, you are welcome to use Dropbox or WebDAV as synchronisation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you change that? dont is not English?

@@ -146,7 +149,7 @@ export default class SyncServiceSignIn extends PureComponent {
.then(() => {
persistField('authenticatedSyncService', 'Google Drive');

gapi.auth2.getAuthInstance().signIn({
gapi.auth2.getAuthInstance().signIn({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure you have prettier installed correctly? This looks like wrong indentation.

@@ -1,13513 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think that this file should be deleted. It's not a temporary .lock file, it's rather an config file to freeze the installed packages and make the build reproducible.
https://classic.yarnpkg.com/en/docs/yarn-lock/

@munen
Copy link
Collaborator

munen commented Jul 28, 2021

Just a quick note from me: @apaes did send me an email before opening the PR. He clearly stated that he’s not a developer, but that he did manage to get OneDrive to work for him. He asked if that would be interesting for upstream organice. I congratulated him on the proper hacker spirit and that this is a great achievement which actually kind of makes him a developer(; I also said that I would look into the PR and help with feedback and testing.

Since the PR has been opened, there was too little time for me to properly look into it. Currently, I’m sitting in a train and am typing this on my phone. I’m off to proper vacation without a laptop for the first time in about 8 years. I did just read through the code and on a first glance it looks like a good base to get OneDrive working. I’ll definitively get back to this PR when I can.

In the meantime, feel free to collaborate with @schoettl who already made some good suggestions. He’s a maintainer of organice, as well.

🙏

@apaes
Copy link
Author

apaes commented Jul 29, 2021 via email

@munen
Copy link
Collaborator

munen commented Jul 29, 2021

No worries, take your time. This is a community FOSS project build in spare time. There’s no deadlines^^

Thank you for the kind wishes! The first day winds down, we’re just coming back from a nice restaurant by the sea. Today has been a greatly relaxing day, indeed. So far, I can recommend this idea of doing a vacation every once in a while(;

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.

3 participants