janko / paperclip-dropbox

[OBSOLETE] Extends Paperclip with Dropbox storage.
MIT License
148 stars 36 forks source link

DropboxError: Forbidden when attempting to upload file #39

Closed vmcilwain closed 10 years ago

vmcilwain commented 10 years ago

I have been attempting to upload a file via the rails console and have not had any luck. Unfortunately the only error I get is DropboxError: Forbidden. The log file doesn't show any additional errors so I'm at a loss on how to debug this. What I have in my model is:

has_attached_file :document,
                     storage: :dropbox,
                     dropbox_credentials: {
                       app_key: "...",
                       app_secret: "...",
                       access_token: "...",
                       access_token_secret: "...",
                       user_id: "123456789"
                     },
                     dropbox_options: {environment: Rails.env},
                     access_type: 'app_folder
 validates_attachment_content_type :document, :content_type => /\Aimage\/.*\Z/

I am looking for any ideas on how I can figure out is not right and how I can fix it so I can upload a file to my dropbox account. Any help is appreciated.

janko commented 10 years ago

You probably didn't authenticate the account properly. So, did you sucessfully run the dropbox:authorize Rake task? Did you remember to update the model file after that?

vmcilwain commented 10 years ago

Hi,

Yes I did successfully run the dropbox:authorize. I wasn't able to run that before when I was having my SSL issues. I knew my SSL issues were correct when I ran that and got a response back which were my tokens. I assume when you mean that I updated my model file that I added the token, token secret, and user id. I didn't see in the documentation if there was anything else aside from that that I needed to add.

janko commented 10 years ago

No, this what you wrote is all. Did you check if your Dropbox application is of "App folder" type?

vmcilwain commented 10 years ago

Oh. Sorry. Yes I did check that the dropbox application was set to "App Folder". I also see that the app folder is created in the drop box account.

janko commented 10 years ago

:access_type should be inside of the :dropbox_credentials hash.

vmcilwain commented 10 years ago

Ah, I'm sorry I missed that. Thats exactly what the problem was.

janko commented 10 years ago

No problem. It's always good to have an extra pair of eyes :)