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

Move files_external backends to separate apps #27049

Closed
5 of 16 tasks
PVince81 opened this issue Jan 30, 2017 · 11 comments
Closed
5 of 16 tasks

Move files_external backends to separate apps #27049

PVince81 opened this issue Jan 30, 2017 · 11 comments

Comments

@PVince81
Copy link
Contributor

PVince81 commented Jan 30, 2017

Port all external storage backends from files_external to be separate apps:

@DeepDiver1975 FYI

@guruz
Copy link
Contributor

guruz commented May 4, 2017

OAuth2: move to core or part of external app ?
OAuth1: move to core or part of external app ?

Note that from desktop client perspective, we'd want to possibly only support OAuth at some point. So if you have it external, you're making life harder when installing oC. Maybe not a big issue.

CC @ogoffart

@PVince81
Copy link
Contributor Author

PVince81 commented May 4, 2017

This is not related at all to the desktop or mobile client.

It's the oauth tokens that the OC server uses to connect to external storages like Dropbox, etc.

@PVince81
Copy link
Contributor Author

PVince81 commented May 4, 2017

and the auth backends listed here are the ones used to connect to external storages from the server.

@PVince81
Copy link
Contributor Author

PVince81 commented Jun 2, 2017

Gdrive: #28074 and https://github.com/owncloud/files_external_gdrive, still work in progress as some adjustments are needed

@Hemant-Mann
Copy link
Contributor

Hello @PVince81 Currently Google Drive OAuth2 Grant sends a request to ajax/oauth2.php which is hard coded for authenticating google drive only, now the new dropbox app that I am writing also need oauth2 authorization so how to go about it?

  1. Add a switch statement in the current ajax/oauth2.php to authenticate multiple backend by passing in the storage identifier like googledrive?
    Or
  2. Modify oauth2.js in such a way that it will fire an event which can then be handled in the app specific js/somejsfile.js to authenticate a storage app using OAuth2

Any other thoughts @butonic ?

@PVince81
Copy link
Contributor Author

@Hemant-Mann we should remove these files from core eventually so don't rely on them. Also in the future core (or its files_external bit) must not know about any specific storage implementation.

So I suggest you grab the oauth2.php and oauth2.js files and provide them in your app and adjust them accordingly. Note that to load a custom JS file you need ->addCustomJS(['appname', 'oauth2.js']) (this was added recently)

@Hemant-Mann
Copy link
Contributor

@PVince81 Okay I will provide customJs as mentioned by you but as of now there is no way for the customJs to know when the OAuth2 grant is request by the client

See this https://github.com/owncloud/core/blob/master/apps/files_external/js/oauth2.js#L65 A click event is attached on the button, and the function sends a request to backend /apps/files_external/ajax/oauth2.php

So instead of hard coding what should happen when the user clicks on the button we can trigger another event on which event handlers can be attached in the customJs provided separately by each backend config (as you suggest core must not know about specific implementation)

After this line https://github.com/owncloud/core/blob/master/apps/files_external/js/oauth2.js#L71
Something like this

$('.configuration').trigger('oauth_step1', [{
	storage_id: tr.attr('class'),
	client_id: client_id,
	client_secret: client_secret,
	redirect: location.protocol + '//' + location.host + location.pathname + '?sectionid=storage',
	context: $(this)
}])

and this event can be handled in the customJS as I am doing it here https://github.com/Hemant-Mann/files_external_dropbox/blob/dev/js/dropbox.js#L41

Any thoughts @butonic ?

@PVince81
Copy link
Contributor Author

As you like, feel free to make a PR to core

@Hemant-Mann Hemant-Mann mentioned this issue Jun 21, 2017
9 tasks
@Hemant-Mann
Copy link
Contributor

PR #28179 with the proposed changes

@DeepDiver1975
Copy link
Member

Secondary s3 storage integration just got move over to https://github.com/owncloud/files_external_s3.

@stale
Copy link

stale bot commented Sep 21, 2021

This issue has been automatically closed.

@stale stale bot closed this as completed Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants