I'm using flickraw gem to get links to photos in my flickr profile and display them on my blog. I'm following the documentation on github but its throwing the following error
Processing by StaticPagesController#index as HTML
Completed 500 Internal Server Error in 916ms
FlickRaw::OAuthClient::FailedResponse - FlickRaw::OAuthCli
flickraw (0.9.8) lib/flickraw/oauth.rb:156:in `post'
flickraw (0.9.8) lib/flickraw/oauth.rb:92:in `post_form'
flickraw (0.9.8) lib/flickraw/api.rb:58:in `call'
flickraw (0.9.8) lib/flickraw/api.rb:48:in `initialize'
flickraw (0.9.8) lib/flickraw.rb:20:in `flickr'
app/controllers/static_pages_controller.rb:6:in `index'
I have the following code in my controller
class StaticPagesController < ApplicationController
def index
token = flickr.get_request_token
auth_url = token['oauth_authorize_url']
puts "Open this url in your process to complete the authication process : #{auth_url}"
puts "Copy here the number given when you complete the process."
verify = gets.strip
begin
flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify)
login = flickr.test.login
puts "You are now authenticated as #{login.username}"
rescue FlickRaw::FailedResponse => e
puts "Authentication failed : #{e.msg}"
end
flickr.photos.search(user_id: "130879534@N07")
end
end
Following is my Flickraw.rb
FlickRaw.secure = false
FlickRaw.api_key = "<api key>"
FlickRaw.shared_secret = "<secret>"
According to the docs it looks like your auth flow should look like this:
FlickRaw.api_key="... Your API key ..."
FlickRaw.shared_secret="... Your shared secret ..."
token = flickr.get_request_token
auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'delete')
puts "Open this url in your process to complete the authication process : #{auth_url}"
puts "Copy here the number given when you complete the process."
verify = gets.strip
begin
flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify)
login = flickr.test.login
puts "You are now authenticated as #{login.username} with token #{flickr.access_token} and secret #{flickr.access_secret}"
rescue FlickRaw::FailedResponse => e
puts "Authentication failed : #{e.msg}"
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.