How to solve this problem--OAuth2::HTTPError: Received HTTP 400 during request problem with facebook_oauth in production server in Ruby on Rails?
I am getting this exception with facebook_oauth 0.2.0 in production server -----------
OAuth2::HTTPError: Received HTTP 400 during request.>
Received HTTP 400 during request.
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/oauth2-0.1.0/lib/oauth2/client.rb:80:in `request'
/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/oauth2-0.1.0/lib/oauth2/strategy/web_server.rb:15:in `get_access_token'
=> when executing this line of ruby code, access_token = @client.authorize(:code => params[:code])
But the same code working in the local server. I stumbled last two days about this issue. 开发者_JAVA技巧Anyone please help me??
I had this exact same problem and spent a fair few maddening hours analysing what looked like good code. Then I did a simple inspect on my oauth client and discovered that it was missing the secret key!
@secret=""
I'd misspelt the ref of the secret key when pulling it from my config YML file! The first part of the authorization process doesn't need the secret, so didn't fail. Anyway, added the secret in, and bamn!
精彩评论