Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3393524
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:03:39+00:00 2026-05-18T04:03:39+00:00

I’m using OmniAuth + Devise to allow users to register using Facebook/Twitter/Gowalla/etc attached to

  • 0

I’m using OmniAuth + Devise to allow users to register using Facebook/Twitter/Gowalla/etc attached to normal user accounts. Now when a user logs in using any of these, or their account, all their social networks are attached in a authentications table.

I need to be able to pull content from any of these providers, such as their tweets or their Facebook Places checkings, etc. I understand that I will need to use a different gem, plugin, whatever to do this but getting the config I need to work with those gems (and make requests) is confusing to me.

I need to be able to access the provider config items in omniauth.rb so I have API Keys and Secret Keys, etc, then I need to be able to grab tokens from the oAuth stuff to make requests.

Other gems like https://github.com/jrallison/authlogic_oauth seem to store oauth_token, oauth_secret and oauth_token, but OmniAuth does not.

As you can probably tell I am very new to Ruby, Rails and oAuth, so this is turning out to be a very challenging application. Help is very much needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:03:39+00:00Added an answer on May 18, 2026 at 4:03 am

    Sorted!

    Added token and secret to the authentications table described in http://railscasts.com/episodes/236-omniauth-part-2 but changed the authentication.build line to take two more parameters:

    authentications.build(
        :provider => omniauth['provider'], 
        :uid => omniauth['uid'], 
        :token => omniauth['credentials']['token'], 
        :secret => omniauth['credentials']['secret']
    )
    

    then used the code example from http://dev.twitter.com/pages/oauth_single_token#ruby

    class CronController < 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 => "http://api.twitter.com"
                    })
                # now create the access token object from passed values
                token_hash = { :oauth_token => oauth_token,
                                             :oauth_token_secret => oauth_token_secret
                                         }
                access_token = OAuth::AccessToken.from_hash(consumer, token_hash )
                return access_token
            end
    
            auth = current_user.authentications.find(:first, :conditions => { :provider => '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 => response.body
        end
    end
    

    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.

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
In order to apply a triggered animation to all ToolTip s in my app,
I want use html5's new tag to play a wav file (currently only supported
I want to count how many characters a certain string has in PHP, but
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.