Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sorted! </p> <p>Added token and secret to the authentications table described in <a href="http://railscasts.com/episodes/236-omniauth-part-2">http://railscasts.com/episodes/236-omniauth-part-2</a> but changed the authentication.build line to take two more parameters:</p> <pre><code>authentications.build( :provider =&gt; omniauth['provider'], :uid =&gt; omniauth['uid'], :token =&gt; omniauth['credentials']['token'], :secret =&gt; omniauth['credentials']['secret'] ) </code></pre> <p>then used the code example from <a href="http://dev.twitter.com/pages/oauth_single_token#ruby">http://dev.twitter.com/pages/oauth_single_token#ruby</a></p> <pre><code>class CronController &lt; ApplicationController def recent_tweets # Exchange your oauth_token and oauth_token_secret for an AccessToken instance. def prepare_access_token(oauth_token, oauth_token_secret) consumer = OAuth::Consumer.new("APIKey", "APISecret" { :site =&gt; "http://api.twitter.com" }) # now create the access token object from passed values token_hash = { :oauth_token =&gt; oauth_token, :oauth_token_secret =&gt; oauth_token_secret } access_token = OAuth::AccessToken.from_hash(consumer, token_hash ) return access_token end auth = current_user.authentications.find(:first, :conditions =&gt; { :provider =&gt; 'twitter' }) # Exchange our oauth_token and oauth_token secret for the AccessToken instance. access_token = prepare_access_token(auth['token'], auth['secret']) # use the access token as an agent to get the home timeline response = access_token.request(:get, "http://api.twitter.com/1/statuses/home_timeline.json") render :json =&gt; response.body end end </code></pre> <p>By pulling the content from current_user.authentications (im finding the first as they should only have one) I can grab the token and security and its alllll good.</p> <p>Now I can tweak this, get stuff saved, faff with the JSON and take what I need. I'm sure Facebook will be pretty similar.</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.
 

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