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

App thinks it is using Google Oauth #3

Open
ConorIA opened this issue Oct 6, 2017 · 28 comments
Open

App thinks it is using Google Oauth #3

ConorIA opened this issue Oct 6, 2017 · 28 comments

Comments

@ConorIA
Copy link

ConorIA commented Oct 6, 2017

When I enter the app key and secret, I get taken to a Google Drive OAUTH page with a 404 error.

ezgif com-video-to-gif

@notjoe
Copy link

notjoe commented Oct 6, 2017

I can confirm this. When I tried granting access again it finally worked.

@ConorIA
Copy link
Author

ConorIA commented Oct 9, 2017

I've tried reinstalling, adding as an admin or as a regular user, creating different Dropbox API credentials. All to no avail.

@ConorIA
Copy link
Author

ConorIA commented Oct 19, 2017

Just thought I'd update here. I tried replacing the Google portions of the URL with the Dropbox info, that is, changing

https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=https%3A%2F%2F**my.nextcloud.url**%2Fsettings%2Fadmin%2Fexternalstorages&client_id=**clientID**&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&access_type=offline&approval_prompt=force

to

https://www.dropbox.com/oauth2/authorize?response_type=code&redirect_uri=https%3A%2F%2F**my.nextcloud.url**%2Fsettings%2Fadmin%2Fexternalstorages&client_id=**clientID**

but it returns an error:

"Step 2 failed. Exception: Error fetching OAuth2 access token, message: 'invalid_client: The OAuth client was not found.'"

EDIT: Changing code to token also doesn't work.

@Teyro
Copy link

Teyro commented Oct 19, 2017

Same here :( Makes me sad.... Did someone get it to work?

@ColdSphinX
Copy link

Yepp, same here...

@ConorIA
Copy link
Author

ConorIA commented Oct 20, 2017

I wonder if we have anything in common... I run Nextcloud via Docker using Wonderfalls's image. Not sure if that has anything to do with the error.

@kosli
Copy link

kosli commented Oct 22, 2017

same issue here with "plain" NextCloud 12.0.3. Files_external and Files_external_dropbox is enabled and as soon as i click on the grant button i get redirected to a google (?!) OAuth2 page with an access denied.
Any update on this issue?

@zeitgeist87
Copy link

It seems to be some kind of race condition in the JS code. The button "Grant access" triggers both the Dropbox and Google Drive JS handlers. Most of the time Google Drive wins, and performs the redirect to the wrong URL. I was able to get the correct URL by stepping through the code with the JS debugger. Then I manually copied it into a new browser tab and it worked.

@ConorIA
Copy link
Author

ConorIA commented Oct 31, 2017

I'm seeing an error on the console:

Loading failed for the <script> with source “https://cloud.conr.ca/apps/files_external_dropbox/js/dropbox.js?v=2ce5bcf75f701fbcfd534faf8b4fda50-36”.
externalstorages:71
Content Security Policy: The page’s settings blocked the loading of a resource at self (“script-src 'nonce-YjhSNDhRY3VlK2gwbnVLdDRGSUR6OS9lekZ2anpSVXRkZlFmUFQ0Kyswdz06SWFVL3VYUkRPS3d4KzdUTGt4UTIvb3lHL1RhWGgzbG5ScFZGQkgxTG5Dcz0=' 'unsafe-eval'”). Source: onfocusin attribute on DIV element.

@Jonthe838
Copy link

Jonthe838 commented Nov 1, 2017

I've managed to get past the grant step but it won't download and I'm getting a ton of errors.

Could not load storage: "Unable to get backend for files_external_dropbox"

Exception: Creating \OCA\Files_external_dropbox\Storage\Dropbox storage failed
--

Anyway this is how I got this far..
When pressing the grant button if it redirects you to google. Copy and paste this link instead:

https://www.dropbox.com/oauth2/authorize?response_type=code&redirect_uri=https%3A%2F%2F**www.YOURDOMAIN.com**%2Findex.php%2Fsettings%2Fadmin%2Fexternalstorages&client_id=**YOURCLIENTID**&scope=&force_reapprove=true
Replace www.YOURDOMAIN.com with your domain and YOURCLIENTID with your client ID

@ConorIA
Copy link
Author

ConorIA commented Nov 1, 2017

@Jonthe838, I get Step 2 failed. Exception: Error fetching OAuth2 access token, message: 'invalid_client: The OAuth client was not found.' when I try your URL workaround. 😞

@Jonthe838
Copy link

@ConorIA That's the same error as you posted before. Double check your Client ID and the URL that you've entered on Dropbox's website for your app, it seems as something doesn't match. Where do you have your Nexcloud installation? What is your file path?

I managed to get it "working" again following the steps that I did earlier today. I still can't download anything but yeah.

One problem that I saw a lot of people having over at the OwnCloud forum was that they tried to copy the Client Secret / key which yielded problems. I don't think that's the case here but its worth noting.

@ConorIA
Copy link
Author

ConorIA commented Nov 1, 2017

@Jonthe838, no such luck. I have no idea what I'm doing wrong. I guess the first thing to rule out: the ClientID is the "App key", right?

@Jonthe838
Copy link

@ConorIA Correct, that is what I used at least. Do your site have SSL? If not, change my link to http. Also what type of access have you given your app? Have you installed all of the dependencies?

I mean I'm fumbling in the dark here, all I did was a little reading up on the documentation for the API v2 and compared it to the link that the "grant button" provided me with and worked my way through it until it matched the examples on dropbox.com and it took me back to my Nextcloud server.

@ConorIA
Copy link
Author

ConorIA commented Nov 1, 2017

@Jonthe838, everything seems to be in order. I've even tried creating another Dropbox API app, but to no avail. Anyway, I will wait it out for now. Thanks for your support!

@leolivier
Copy link

leolivier commented Nov 5, 2017

@ConorIA I had exactly the same problem and as said by @Jonthe838 I just typed my secret key instead of copy/pasting it and... it worked!
Sadly, when I go to the files page and click on external storage and the name of my mounting point, then it starts running forever and I can't see any dropbox content...

Edit: well, you just need to be patient, I now can see the files, but as noted in another issues, all files and directory names are lower case...

@darkmattercoder
Copy link

This is also true for me on nc 12.03. I also tried to type instead of paste both key and secret but to no avail. In my case, I also see #11 at the same time.

@icewind1991
Copy link
Owner

Please retry with latest master if you're running into this issue

@ConorIA
Copy link
Author

ConorIA commented Nov 9, 2017

I'm still getting a Google OAuth page.

@darkmattercoder
Copy link

With the latest master, it indeed works for me. I had to re-add the app on the dropbox website and also I saw a notification popup two or three times about failed Oauth2 verification though, before the external storage became green.

@ConorIA
Copy link
Author

ConorIA commented Nov 9, 2017

My issue with the client not being found made me think to check the db:

MariaDB [nextcloud]> SELECT * FROM oc_external_mounts;    
+----------+--------------+------------------------+----------------+----------+------+
| mount_id | mount_point  | storage_backend        | auth_backend   | priority | type |
+----------+--------------+------------------------+----------------+----------+------+
|       11 | /GoogleDrive | googledrive            | oauth2::oauth2 |      100 |    1 |
|       20 | /Dropbox     | files_external_dropbox | oauth2::oauth2 |      100 |    1 |
+----------+--------------+------------------------+----------------+----------+------+
2 rows in set (0.00 sec)

MariaDB [nextcloud]> SELECT * FROM oc_external_config;    
+-----------+----------+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| config_id | mount_id | key           | value                                                                                                                                                                                                                                                                              |
+-----------+----------+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|        43 |       11 | configured    | true                                                                                                                                                                                                                                                                               |
|        44 |       11 | client_id     | XXXX.apps.googleusercontent.com                                                                                                                                                                                                           |
|        45 |       11 | client_secret | XXXX                                                                                                                                                                                                                                                           |
|        46 |       11 | token         | {"access_token":"XXXX","expires_in":3600,"refresh_token":"XXXX","token_type":"Bearer","created":1507322628} |
|        79 |       20 | configured    | false                                                                                                                                                                                                                                                                              |
|        80 |       20 | client_id     | XXXX                                                                                                                                                                                                                                                                    |
|        81 |       20 | client_secret | XXXX                                                                                                                                                                                                                                                                    |
|        82 |       20 | token         | false                                                                                                                                                                                                                                                                              |
+-----------+----------+---------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
8 rows in set (0.00 sec)

MariaDB [nextcloud]> 


@johenning
Copy link

By manually typing App key and App secret, I got the authorization process to finish, but syncing does not work. The root directory of my Dropbox got synced, but nothing else.

The log is flooded with 'Could not load storage: "Unable to get backend for files_external_dropbox"', which might be because of these to entries from around the time I set up the authorization:

  • Narrowing occurred during type inference. Please file a bug report on bugs.php.net at /var/www/nextcloud/lib/composer/composer/ClassLoader.php#444

  • Exception: Creating \OCA\Files_external_dropbox\Storage\Dropbox storage failed

Sitenote: "Function mcrypt_create_iv() is deprecated at /var/www/nextcloud/apps/files_external_dropbox/vendor/kunalvarma05/dropbox-php-sdk/src/Dropbox/Security/McryptRandomStringGenerator.php#47"

@icewind1991
Copy link
Owner

People are reporting various problems is this issue, does anyone still experience the original "thinks it's google drive" issue with latest master?

@ConorIA
Copy link
Author

ConorIA commented Dec 21, 2017

Yes. I've never had any luck getting past the auth.

@icewind1991
Copy link
Owner

@ConorIA

Yes. I've never had any luck getting past the auth.

Are you having the problem described in the original issue (being redirected to google auth instead of dropbox) or something else.

@ConorIA
Copy link
Author

ConorIA commented Feb 7, 2018 via email

@simonbru
Copy link

@ConorIA I think this issue occurs when the app is installed in a secondary app folder (e.g. the custom_apps folder when using the docker image).
As a workaround, you could copy files_external_dropbox from custom_apps/ into apps/. Once the dropbox folder is configured you can delete the app from apps/ (or let Nextcloud do it at the next upgrade).

@ConorIA
Copy link
Author

ConorIA commented May 15, 2018

@simonbru. That's done the trick. Thanks!

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

No branches or pull requests