Search code examples
ruby-on-railsrubyfacebook-graph-apioauthkoala

Setup simple facebook oauth using koala ruby gem


Right now I am pulling facebook profile photo in my app using

 graph = Koala::Facebook::API.new
    profile_path = graph.get_picture("username",:type=>"large")
    @user.update_attributes(:profile_pic => profile_path)

And display it using

<%= image_tag  @user.profile_pic%>

It is showing up fine.

But what I would like to do is setup an OAuth, where in users can login and the app would retrieve the logged in user's username to parse in above. Since right now I am doing it manually, as you can see above.

It might be a silly a question. But for some reason, I am not able to figure out where to start in order to implement OAuth. That is how should the login page be setup ? And how should the call back be? I am bale to signup an app on Facebook. But dont know what to do next.

Any help is appreciated.

Thanks much.


Solution

  • maybe here is where you can start from

    http://railscasts.com/episodes/360-facebook-authentication

    railscast always good to seek for sources.