How to resolve "oauth_signature passed in invalid" when uploading video using vimeo gem?

I spent several hours figuring out how to get all the credentials needed to update my own videos on Vimeo using the vimeo gem . I understand that I have to manually authorize the native app for my account. I followed the instructions in the readme :

base = Vimeo::Advanced::Base.new(App.vimeo[:consumer_key], App.vimeo[:consumer_secret])
request_token = base.get_request_token

      

Then I find base.authorize_url

and I see Allow "App" to access your Vimeo account?

. I click "Allow" and I see code that looks like unicorn-weipo

. I guess that oauth_verifier

. Vimeo doesn't send me to the url specified in my app settings. And I don't see anything else on the page that tells me what mine is oauth_token

. So, I think mine oauth_token

is this request_token

token

. I try:

base = Vimeo::Advanced::Base.new(App.vimeo[:consumer_key], App.vimeo[:consumer_secret])
access_token = base.get_access_token(request_token.token, request_token.secret, 'unicorn-weipo')

      

So far so good. So let's keep the token and the secret access_token

:

user_token = access_token.token
user_secret = access_token.secret

      

Do something simple first and list all the videos (by the way, the readme says get_videos

, but now it looks like get_all

):

video = Vimeo::Advanced::Video.new(App.vimeo[:consumer_key], App.vimeo[:consumer_secret], :token => user_token, :secret => user_secret)
video.get_all('user10513902')

      

The answer looks good:

{"generated_in"=>"0.0227", "stat"=>"ok", "videos"=>{"on_this_page"=>"0", "page"=>"1", "perpage"=>"50", "total"=>"0", "video"=>[]}}

      

Now I want to download something:

upload = Vimeo::Advanced::Upload.new(App.vimeo[:consumer_key], App[:consumer_secret], :token => user_token, :secret => user_secret)
f = File.open(File.join(Rails.root, 'spec', 'fixtures', 'sample.avi'))
upload.upload(f)

      

But then I see this:

Vimeo::Advanced::RequestFailed: 303: Invalid signature, explanation: The oauth_signature passed was not valid

      

How to fix it? I want to be able to upload videos.

Thank!

+3


source to share





All Articles