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 7708545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:38:22+00:00 2026-06-01T00:38:22+00:00

I’m working on a Rails 3.2 application that will allow users to authenticate with

  • 0

I’m working on a Rails 3.2 application that will allow users to authenticate with multiple providers … Yahoo, Google, Facebook and/or Twitter. We are using omniauth, and while I understand the basic workflow, I cannot find an inclusive document that states how each of these specific providers should be configured nor how a Rails application should be set up so that I can properly test/use these strategies in development, test and production environments.

So my questions:

  1. For each of these providers (yahoo, google, twitter, facebook), what steps are necessary to configure each one individually for omniauth so that they can be used in development, test and production environments?

  2. What is the best/recommended way to configure the Rails application to properly use each of these providers for whatever environment I’m running in?

Thanks – wg

  • 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-06-01T00:38:24+00:00Added an answer on June 1, 2026 at 12:38 am

    As for your first question:

    You need to create apps for Facebook, Google and Twitter to allow the use of their OAuth protocol. As for Yahoo, I don’t know. Is Yahoo still relevant? Just kidding. For a list of all the available Omniauth provider strategies, go here.

    So, Facebook:

    https://developers.facebook.com/apps
    Create app. You'll be given an API Key and an API Secret.
    Settings > Basic > Website > Site URL:
      your_website_callback_url for production
    

    Twitter:

    https://apps.twitter.com/
    Create app. You'll be given an API Key and an API Secret.
    Settings > Callback URL:
      your_website_callback_url for production
    

    Google:

    https://console.developers.google.com
    Create app. You'll be given an API Key and an API Secret.
    Services > Select necessary services and scopes
    APIs & auth > Credentials > Create New Client ID:
      http://localhost:3000/ for development/testing
      your_website_callback_url for production
    

    Then, your Gemfile:

    gem 'omniauth-facebook'
    gem 'omniauth-twitter'
    gem 'omniauth-google-oauth2'
    

    Create a file to setup your strategies. The convention is naming it omniauth.rb. There are a bunch of different options available to each provider, you’ll have to investigate what those are:

    # config/initializers/omniauth.rb
    Rails.application.config.middleware.use OmniAuth::Builder do
      provider :facebook, 'FACEBOOK_KEY', 'FACEBOOK_SECRET', {
        secure_image_url: 'true',
        image_size: 'square'
      }
    
      provider :twitter, 'TWITTER_KEY', 'TWITTER_SECRET', {
        secure_image_url: 'true',
        image_size: 'normal'
      }
    
      provider :google_oauth2, 'GOOGLE_KEY', 'GOOGLE_SECRET', {
        image_size: 50,
        image_aspect_ratio: 'square'
      }
    end
    

    And then follow this railscast and this wiki. You should be using environment variables like ENV['FACEBOOK_KEY'] and setting them in the console so that you can change them during runtime and so that they don’t get pushed in a certain file into your repositoriy (specially if you have a public one). Here’s a solution to this problem.

    Finally, you should search for each provider’s gem wiki for extra info. For instance, facebook’s omniauth gem readme provides an example of an authentication hash returned by Facebook when a user authenticates through Facebook. You can then use this information to customize your user model (update his full name or his image, according to what you want to do). It also mentions how you can ask for extra permissions to access user data that is not publicly available.

    Edit: To answer your question:

    Like I said, I really like Railscasts and I followed 2 episodes where Devise and OmniAuth were integrated. In those episodes, the omniauth-openid gem is used to authenticate with Google. The downside of it is that since you don’t register an app, you can’t customize the authentication prompt. With Facebook and Twitter you’re able to choose a name, type a description and upload the logo of your application. You can also set links to the “Privacy” and “Terms of Use” pages on your website. All these little details will appear to the user when he tries logging in with those services and, as you can imagine, they affect your user conversion rates.

    With omniauth-openid you can’t customize the prompt and the information you get is limited (only the email and the name associated with the account). If that’s all you need, then you’re all set. If, however, you want to get the user’s image, maybe access other private info only available from the user’s Google+ profile, then it’s probably better to just go with omniauth-google2.

    The good thing about OmniAuth is that once you get the basic foundation working, adding other providers is as easy as registering an app, getting an API key and secret and including a certain gem. I’d suggest starting first with Facebook since it’s the most popular service and as such is the one with the most documentation (or at least the one with more questions here on SO). From there, build on your application and add other authentication methods.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

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.