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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:09:15+00:00 2026-05-27T07:09:15+00:00

My Omniauth integration works on local development but fails for google on staging. require

  • 0

My Omniauth integration works on local development but fails for google on staging.

require 'omniauth/openid'
require 'openid/store/memcache'

Rails.application.config.middleware.use OmniAuth::Builder do
  OmniAuth.config.full_host = "http://xx.xx.xxx/"

  # dedicated openid
   provider :open_id, OpenID::Store::Memcache.new(Dalli::Client.new), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'

end

I get a this error message:

Started GET “/auth/failure?message=invalid_credentials” for 58.71.19.178 at 2011-12-01 02:22:20 +0000
Processing by ErrorsController#routing as HTML
Parameters: {“message”=>”invalid_credentials”, “a”=>”auth/failure”}
Rendered public/404.html (0.1ms)
Completed 404 Not Found in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)

Also the ip in for is not the same in my OmniAuth.config.full_host maybe that could be causing the issue?

  • 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-27T07:09:16+00:00Added an answer on May 27, 2026 at 7:09 am

    The culprit was that apache sending and returning on different ips

    This monkey patch fixed the issue.

    module OmniAuth
      module Strategies
        # OmniAuth strategy for connecting via OpenID. This allows for connection
        # to a wide variety of sites, some of which are listed [on the OpenID website](http://openid.net/get-an-openid/).
        class OpenID
          protected
          def callback_url
            uri = URI.parse(request.url)
            uri.path += '/callback'
    
            # by KirylP: to overcome hosting subdomain forwarding to rails port        
            uri.port = '' if request.env.has_key? 'HTTP_X_FORWARDED_SERVER'
    
            uri.to_s
          end
        end
      end
    end
    
    module Rack
      class OpenID
        SERVER_PORT_TO_AVOID = 12002
    
        private
        def realm_url(req)
          url = req.scheme + "://"
          url << req.host
    
          scheme, port = req.scheme, req.port
          if scheme == "https" && port != 443 ||
              scheme == "http" && port != 80
            url << ":#{port}" if port != SERVER_PORT_TO_AVOID # KirylP
          end
    
          url
        end
      end
    end
    
    module OpenID
      class Consumer
        def complete(query, current_url)
          message = Message.from_post_args(query)
    
          current_url.sub!(":#{Rack::OpenID::SERVER_PORT_TO_AVOID}", '') # KirylP
    
          mode = message.get_arg(OPENID_NS, 'mode', 'invalid')
          begin
            meth = method('complete_' + mode)
          rescue NameError
            meth = method(:complete_invalid)
          end
          response = meth.call(message, current_url)
          cleanup_last_requested_endpoint
          if [SUCCESS, CANCEL].member?(response.status)
            cleanup_session
          end
          return response
        end    
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to use omniauth in my rails application. I was just curious,
I need to test the omniauth-facebook authentication from my local application. However, the Facebook
I'm building a Rails application using Devise. Devise is all set up even omniauth.
I've added Omniauth to my rails 3.1 project and it all works fine. When
My Rails 3 app has three customized controllers for my Devise + OmniAuth integration.
My current /config/initializers/omniauth.rb file contains: Rails.application.config.middleware.use OmniAuth::Builder do provider :open_id, nil, :name => 'google',
I have OmniAuth setup to use Twitter like so: Rails.application.config.middleware.use OmniAuth::Builder do provider :twitter,
I am using Omniauth 1.0.1 in my Rails app for authentication. I have omniauth-google-oauth2
I'm using omniauth exclusively to allow login to my website with facebook/google/twitter. I store
I am developing a Rails app using OmniAuth, OmniAuth-salesforce and this gem: https://github.com/heroku/databasedotcom I

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.