Mosts FB Requests broken after upgrade to 0.5.0 #68

eriksundelof opened this Issue Aug 25, 2011 · 8 comments


None yet

7 participants


One of the main problems is that the automatic parser is not working anymore. The key :automatic does not exist from what I see making access_token requests pretty broken.

Line 127 in client.rb cannot work now from what I understand as the parsing is busted.
raise unless response.parsed.is_a?(Hash) && response.parsed['access_token']

This makes integration with Facebook much more verbose than needed.

Secondly it seems as most token_url's now have to be added while calling which was not the case before.

Any updates on when these can be fixed?


I have same problems, when trying to access users's data recieve following trace:

/home/deteam/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/gems/1.8/gems/oauth2-0.5.0/lib/oauth2/client.rb:107:in `request'
/home/deteam/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/gems/1.8/gems/oauth2-0.5.0/lib/oauth2/client.rb:127:in `get_token'
/home/deteam/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/gems/1.8/gems/oauth2-0.5.0/lib/oauth2/strategy/auth_code.rb:28:in `get_token'

I concur with this. I get the same error as DeTeam


Also seeing this


Dug a bit deeper:

OAuth2 is still a draft specification (right now at v22), and changes over time. One of the changes made was that the Authorization header containing the bearer token should not start with "OAuth " but with "Bearer ". See (note: this article doesn't discuss any of Facebook specific stuff, just OAuth2 in general). The default name was changed in the gem in 5493f20 . Facebook however has not updated (yet) and still expects the header to start with "OAuth "

So basically this is not a bug.

To fix, simply pass the correct format to the AccessToken#initialize method, access_token_string, {:header_format => 'OAuth %s'})

One other thing I ran into, is that in 0.3.0 it was possible to do:

response_body_string = token.request(*args)

In 0.5.1, one needs to explicitly request the body

response_body_string = token.request(*args).body

@reinhrst this ok for me when I use:


But when I try to use:'/me/feed', :message => "hi, I'm posting a message from ruby")

Receive the same error:

OAuth2::Error: OAuth2::Error
from /Users/willywg/.rvm/gems/ruby-1.9.3-p0/gems/oauth2-0.5.2/lib/oauth2/client.rb:107:in `request'

OK, I don't think I ever tried it with posts... I don't have access to my facebook code anymore, so can't test it for you.

If I were you I would check if post indeed sends the correct header now (with OAuth in stead of Bearer).

Also, there are about a million other reasons why you may get an OAuth2::Error. Make sure you see what Facebook is actually sending you back (it may just be that your token is not allowed to post...)

INTRIDEA Inc. member

Is this fixed in the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment