DropBox, Wrong authorization URL (Moodle 2.0.2)

DropBox, Wrong authorization URL (Moodle 2.0.2)

by Guillermo Madero -
Number of replies: 7

It's been a little while that I made my first tests with the DropBox repository; at that time I was using Moodle 2.0 and hadn't any problems with it.

Today, using Moodle 2.0.2, I tried to add a file resource through my DropBox, and after clicking on the log in button, I got the following message:

Wrong authorization URL
For the best user experience, you should be sending users to https://www.dropbox.com/0/oauth/authorize, as per the documentation.

I don't know, but it seems that somewhere in the Moodle code the URL needs to be updated. Right now the file picker opens a window with the following address:

https://api.dropbox.com/0/oauth/

whereas it should be the next one:

https://www.dropbox.com/0/oauth/

To be able to access my DropBox files, I had to copy the URL, open a new browser tab, paste the address, change the "api" part to "www" and press Enter. A message then appeared saying something about the way the window had been opened, but that everything was OK and that I should be able to use the file picker without any problems. After returning to my Moodle tab and selecting the DropBox repository, everything went fine.

Cheers!

Average of ratings: -
In reply to Guillermo Madero

Ang: DropBox, Wrong authorization URL (Moodle 2.0.2)

by Bente Olsen -
Picture of Testers Picture of Translators

Hi Guillermo

Thanks for this, I have the same problem. Unfortunately if I try to log in on https://www.dropbox.com/0/oauth/ instead of https://api.dropbox.com/0/oauth/ I get into the web interface, I do not get access from Moodle. In the web interface there is a warning on red background in top of the site: "This app authorization session has expired. Please return to the app to try again."

(Moodle 2.0.2)

In reply to Guillermo Madero

Re: DropBox, Wrong authorization URL (Moodle 2.0.2)

by Mark Bryant -

I have the exact same problem.  If I copy and paste

https://www.dropbox.com/0/oauth/authorize

into a new tab.  I get access to my dropbox files.

In reply to Mark Bryant

Re: DropBox, Wrong authorization URL (Moodle 2.0.2)

by Guillermo Madero -

The web interface is used only to activate the authorization process.

Once it finishes and Moodle has been granted access to DropBox, you should close de DropBox tab, return to Moodle and retry; you shouldn't have any problems thereafter.

Cheers!

In reply to Guillermo Madero

Re: DropBox, Wrong authorization URL (Moodle 2.0.2)

by John Paul Posada -

Hi all, thanks for the postings. I fixed this thanks to your suggestions by editing line 74 in the lib.php file located here:

moodle/repository/dropbox/lib.php

Line 74

From -

'api_root' => 'http://api.dropbox.com/0/oauth',

To -

'api_root' => 'http://www.dropbox.com/0/oauth',

Once I used the Dropbox repository I was able to login with my dropbox account without any errors and before the window closed I got the following message from dropbox:

The app 'Moodle 2.0 Dev' would like to connect with your Dropbox.

  • Please make sure you trust this app before proceeding.
  • You can always remove this app by visiting the Apps page.
  • You're currently logged in as my_account@my_email.com. If you meant to connect from another account logout.

Seems to work fine now.

Cheers!

Average of ratings: Useful (3)
In reply to John Paul Posada

Re: DropBox, Wrong authorization URL (Moodle 2.0.2)

by Hartmut Scherer -

Hi John Paul,

Thanks a lot for sharing the fix for lib.php in DropBox. Together with another tip, not to use spaces in folder or file names, the plugin works fine.

With kind regards,

Hartmut