I am using koala(1.3.0) with rails (3.0.7).
This is how I use them.
Link to click function of facebook
<%= link_to 'Facebook Login', Koala::Facebook::OAuth.new.url_for_oauth_code(:callback => facebook_redirect_url), :class => "facebook_login" %>
This goes to following link
https://graph.facebook.com/oauth/authorize?client_id=MY_APP_ID&redirect_uri=http%3A%2F%2Fexample.example.com%2Ffacebook%2Fredirect
Now I get the code in params in my facebook controller of redirect. Following is what I do next in redirect method of facebook controller.
session[:access_token] = Koala::Facebook::OAuth.new(url_r).get_access_token(params[:code]) if params[:code]
but this line of code gives faraday ConnectionFailed error.
I am stuck at this point. Can't figure out what is the reason behind this.
I have also done the following with this another way also. After I get code in params
facebook_access_token_redirect_link = "https://graph.facebook.com/oauth/access_token?client_id=355***************&redirect_uri=#{url_i}&client_secret=MY_APP_SECRET&code=#{params[:code]}"
and redirect to this link. But then I get an error from facebook Error validating verification code
I don't understand this also.
Any help regarding this is appreciated.
Thanks.
It was a silly thing. The server I was hosting my app at has banned all https connections.
Removed that restriction and I got koala working.