Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to respond to the GET request with a challenge response. I have the same route for both POST and GET requests and use the following code:</p> <p>route:</p> <pre><code>match "facebook/subscription", :controller =&gt; :facebook, :action =&gt; :subscription, :as =&gt; 'facebook_subscription', :via =&gt; [:get,:post] </code></pre> <p>controller:</p> <pre><code> def realtime_request?(request) ((request.method == "GET" &amp;&amp; params['hub.mode'].present?) || (request.method == "POST" &amp;&amp; request.headers['X-Hub-Signature'].present?)) end def subscription if(realtime_request?(request)) case request.method when "GET" challenge = Koala::Facebook::RealtimeUpdates.meet_challenge(params,'SOME_TOKEN_HERE') if(challenge) render :text =&gt; challenge else render :text =&gt; 'Failed to authorize facebook challenge request' end when "POST" case params['object'] # Do logic here... render :text =&gt; 'Thanks for the update.' end end end </code></pre> <p>That should get you going with things... Note that to make a subscription I am using this:</p> <pre><code>@access_token ||= Koala::Facebook::OAuth.new(FACEBOOK_API_KEY,FACEBOOK_API_SECRET).get_app_access_token @realtime = Koala::Facebook::RealtimeUpdates.new(:app_id =&gt; FACEBOOK_API_KEY, :app_access_token =&gt; @access_token) @realtime.subscribe('user', 'first_name,uid,etc...', facebook_subscription_url,'SOME_TOKEN_HERE') </code></pre> <p>I think the key is that you properly respond to the GET request from Facebook. They use this to verify that they are contacting the correct server prior to sending confidential info about their users.</p> <p>Also -- its been a while since I've looked at this, but if I remember correctly, I seem to recall having issues with anything besides default protocol port specifications within the callback URL. Ex: <a href="http://www.something.com:8080/subscription">http://www.something.com:8080/subscription</a> did not work -- it had to be <a href="http://www.something.com/subscription">http://www.something.com/subscription</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload