SoapSeller / omniauth-facebook-access-token

51 stars 68 forks source link

I'm still not sure how to use this gem... #9

Closed pdobb closed 10 years ago

pdobb commented 10 years ago

Hi,

I'm stumped and wondering if you can help illuminate for me how to use this gem? I followed the usage instructions as best I know how. Also, I've got omniauth-facebook installed and working for web-based OAuth... and so now I want to be able to sign in with Facebook's client-side OAuth from a mobile app that is in development. But I'm not sure how to know this gem is doing anything... or how to ultimately confirm that the client-side OAuth is working to log in a mobile app user on the server side. Unfortunately, our mobile app isn't actually built yet so... I've tried curling e.g. curl "http://localhost:3000/user/auth/facebook_access_token/callback?access_token=1234567890" but my server responds with:

Started GET "/user/auth/facebook_access_token/callback?access_token=1234567890" for 127.0.0.1 at 2014-06-17 13:44:43 -0400
I, [2014-06-17T13:44:43.324966 #75839]  INFO -- omniauth: (facebook_access_token) Callback phase initiated.
E, [2014-06-17T13:44:43.532455 #75839] ERROR -- omniauth: (facebook_access_token) Authentication failure! invalid_credentials: OAuth2::Error, {"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190}:
{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190}}
Processing by OmniauthCallbacksController#failure as */*
  Parameters: {"access_token"=>"1234567890"}
Redirected to http://localhost:3000/user/sign_in
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)

I take this as somewhat of a success... but is it failing because I just made up that token -- i.e. it didn't actually come from Facebook? Is there a way to test this stuff outside of running in the mobile app in a live scenario?

SoapSeller commented 10 years ago

First, I don't believe that issues are the right place to discuss this kind of things, a short answer will follow, but I'm closing this issue - if the answer won't solve you problems please feel free to contact me via email (my nickname at gmail.com).

The best way to test it is by setting up a skeleton of real app, you can simply implement a static html page using FB javascript sdk and pipe the the access token to your server.

I think you should be able to acquire a valid token for your facebook app by using Facbook's Access Token Tool but I never tried it myself.

pdobb commented 10 years ago

Thanks, @SoapSeller. I made an issue just because I was thinking that others probably had similar questions and adding details to the README would be nice. If I get my issues figured out I will make a pull request detailing whatever it was that I was missing here. Thanks for the answer, though, that at least gives me a good lead!

SoapSeller commented 10 years ago

@pdobb, np. I'm not sure that I'll have the time to update the README in the near future, but if you'll open a pull request I'll gladly merge it in...