Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct token produces "Koala::Facebook::APIError (OAuthException: Error validating application.)" #26

Closed
jensb opened this issue Jan 20, 2011 · 6 comments

Comments

@jensb
Copy link

jensb commented Jan 20, 2011

I use Koala together with Omniauth to integrate into Facebook. Omniauth works fine so far and after authenticating the user, it produces an access token in the "uid | code-code | code" format. Using this code in the browser via

 https://graph.facebook.com/me?access_token=... 

works fine. However, using this code (my_token) as follows

    g = Koala::Facebook::GraphAPI.new(urlescape(my_token))
    mylogger g.get_object("me")

produces

 Koala::Facebook::APIError (OAuthException: Error validating application.):
  koala (0.10.0) lib/koala/graph_api.rb:184:in `graph_call'
  koala (0.10.0) lib/koala.rb:77:in `api'
  koala (0.10.0) lib/koala/graph_api.rb:181:in `graph_call'
  koala (0.10.0) lib/koala/graph_api.rb:88:in `get_object'

Why is that ... can you please help?

Thank you!

@arsduo
Copy link
Owner

arsduo commented Jan 21, 2011

Hey jensb,

You don't need to urlescape the token -- it comes back from Facebook immediately usable (from both the redirect-based and the Javascript-based methods). The uid|code|code format goes straight into Koala.

Let me know if that works!

Best,

Alex

Alex

@jensb
Copy link
Author

jensb commented Jan 21, 2011

Hello,

sorry ... neither methods work. Any other ideas?

I tried logging both tokens, but using exactly that token in the URL at graph.facebook.com works.

Does Koala log debugging information somewhere?

Thank you!

@jensb
Copy link
Author

jensb commented Jan 23, 2011

Strange.. now it works suddenly. I did not change the code at all.

Thanks for your reply! I'm now going to check out the TestUsers API to write some RSpec tests.

@jobster
Copy link
Contributor

jobster commented Feb 19, 2011

I'm having the exact same error. My access token works fine in the Rails console but if I run the code on my development server, I get the EXACT same OAuthException and Koala stack trace.

Also, I should note that I am NOT using urlescape.

@mwmitchell
Copy link

I'm getting a similar result. If I'm logged out of my app, then log into FB in a different window on facebook.com, then go back to my app and refresh the page... the fb-login-button says I'm logged in, but the data returned from @oauth.get_user_info_from_cookie is nil. If I then refresh the page, @oauth.get_user_info_from_cookie contains the expected hash.

@arsduo
Copy link
Owner

arsduo commented Apr 4, 2011

@mwmitchell: That sounds like an issue with the FB Javascript library and the cookie timing -- the library may not have updated your status with Facebook at the time the server is trying to read the cookies. Can you see if the cookies were set in the browser at the time of the mismatch?

This is probably not a Koala issue, but you could file an issue against the Facebook Connect SDK (https://github.com/facebook/connect-js).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants