Search code examples
ruby-on-railsruby-on-rails-3backupdropbox

Why can't I connect to Dropbox using OAuth?


I want to store my db backup in my dropbox account every night. For this I'm using Backup + dropbox gem. My Ruby version is 1.8.7p358 and Rails 2.3.8 and I'm using a Mysql database.

Here is my error in console

[2012/10/26 11:25:28][error]ModelError: Backup for My Backup (my_backup) Failed!
[2012/10/26 11:25:28][error]   An Error occured which has caused this Backup to abort before completion.
[2012/10/26 11:25:28][error]   Please review the Log for this Backup to determine if steps need to be taken
[2012/10/26 11:25:28][error]   to clean up, based on the point at which the failure occured.
[2012/10/26 11:25:28][error]   Reason: OAuth::Unauthorized
[2012/10/26 11:25:28][error]   401 Unauthorized

Here is my code

    Backup::Model.new(:my_backup, 'My Backup') do

      database MySQL do |db|
        db.name               = "app_development"
        db.username           = "user"
        db.password           = "pass"
        db.host               = "127.0.0.1"
      end

      store_with Dropbox do |db|
        db.api_key    = 'nvpsggrunft0'
        db.api_secret = '71dvvvdx48hy3'
        db.path       = '/backups'
        db.keep       = 80
        db.timeout    = 443
      end


      store_with FTP do |server|
        server.username = 'aadddn'
        server.password = 'tdsddsd'
        server.ip       = 'Ip Address'
        server.port     = 21
        server.path     = ''
        server.keep     = 30
        server.passive_mode = true
      end

      compress_with Gzip do |compression|
        compression.best = true
        compression.fast = false
      end

      notify_by Mail do |mail|
        mail.on_success           = true
        mail.on_failure           = true

        mail.from                 = 'xyx@abc.com'
        mail.to                   = 'sumit.munot@cipher-tech.com'
        mail.address              = 'mail.abc.com'
        mail.port                 = 26
        mail.domain               = 'abc.com'
        mail.user_name            = 'abc'
        mail.password             = 'gvgfgxvxv'
        mail.authentication       = 'login'
        mail.enable_starttls_auto = false
      end  
end

I am running the following command in console for taking the backup

backup perform -t my_backup -c /home/xyz/my_workplace/abc/lib/Backup/config.rb 

Solution

  • Oauth authorization URL will display on previous version of Drop box gem. We can simply solve the problem by clicking on the link it authorize your machine. And back will successfully saved on Drop box.