dizda / CloudBackupBundle

Be able to backup your database(s) and upload it to the cloud (Dropbox, Amazon S3, GoogleDrive, etc.)
MIT License
196 stars 57 forks source link

Dropbox upload : "Cannot extract login CSRF token" #57

Closed clemlatz closed 9 years ago

clemlatz commented 9 years ago

I'm using CloudBackupBundle to backup my database and upload it to Dropbox every hour with cron. Everything was working just fine since yesterday. Now I'm receiving mails like this :

Cannot extract login CSRF token.( code: 268699650; file: /Users/clement/Projets/draftquest/draftquest/vendor/hakre/dropbox-uploader/DropboxUploader.php; line: 260)

The same thing happens with dizda:backup:start :

- Dumping MySQL database... OK
- Compressing archive...  OK
- Uploading to Dropbox... 

  [Exception]                       
  Cannot extract login CSRF token.  

dizda:backup:start [-F|--folders] [processor]

My dropbox credentials didn't change and I can still use them from the dropbox website. My dropbox is far from full. I tried to composer update but it didn't solved the problem. Any ideas ?

dizda commented 9 years ago

Hmm I guess that Dropbox changed the way to login. You should post an issue to the library maintainer which is https://github.com/jakajancar/DropboxUploader

clemlatz commented 9 years ago

Thanks, I will do that.

clemlatz commented 9 years ago

By the way, the DropboxUploader readme says this:

Its development was started before Dropbox released their API, and to work, it scrapes their website. So you can and probably should use their API now as it is much more stable.

dizda commented 9 years ago

Yes, that's why you can also use the other way (OAuth2 way) with Gaufrette, it's explained there: https://github.com/KnpLabs/KnpGaufretteBundle#dropbox-dropbox The CloudBackupBundle can also work with the GaufretteBundle.

ghost commented 9 years ago

Hey, please try to change the code in DropboxUploader.php from: if (!pregmatch('#, "TOKEN": "([A-Za-z0-9-]+)", #', $html, $matches)) to: if (!preg_match(', jscsrf=([A-Za-z0-9-]+), ', $html, $matches))

Let me know if that works. For me it worked fine.

dizda commented 9 years ago

You should send a pull request to the library https://github.com/jakajancar/DropboxUploader @mariosk

ghost commented 9 years ago

Done: https://github.com/hakre/DropboxUploader/pull/4

dizda commented 9 years ago

:+1:

hakre commented 9 years ago

v1.1.22 should address this, it contains the token extraction suggested here as fix as well as falling back to the input element as suggested in DropboxUploader #52. Just FYI.

dizda commented 9 years ago

Thanks @hakre.

Is that ok to you @mariosk @iwazaru ?

clemlatz commented 9 years ago

It is, thanks !