The website encountered an error while retrieving omniauth-google-oauth2
<p>I'm working on a website and doing social media logins for <code>facebook</code> and <code>google</code>. <code>Facebook</code> works fine on <code>development</code> &amp; <code>production</code> but when i try to login with google it throws error </p>

<blockquote>
  <p>server error : 500 </p>
  
  <p>The website encountered an error while retrieving
  <a href="http://app.domain.com/omniauth/google_oauth2/callback?state=abc" rel="nofollow">http://app.domain.com/omniauth/google_oauth2/callback?state=abc</a>. It
  may be down for maintenance or configured incorrectly.</p>
</blockquote>

<p>and my logs show me this (below)</p>

<blockquote>
  <p>I, [2016-03-17T06:]  INFO -- omniauth: (google_oauth2) Request phase
  initiated. I, [2016-03-17T06:]  INFO -- omniauth: (google_oauth2)
  Callback phase initiated.</p>
</blockquote>

<p>I searched about this and they all saying that this can be due to some <code>plugin</code> (#in my case <code>gems</code>) incompatibality . My <code>Gemfile</code> looks like this</p>

<p><strong>GemFile</strong></p>

<pre><code>source 'https://rubygems.org'


gem 'rails', '4.2.5'
gem 'rails-api'
gem 'spring', :group =&gt; :development
gem 'mysql2'
gem 'byebug'

gem 'devise'
gem 'devise_token_auth'

gem 'rack-cors', :require =&gt; 'rack/cors'
gem 'carrierwave'
#gem 'carrierwave-base64-storage'
gem 'carrierwave-base64'
gem 'rmagick' 

gem 'therubyracer'
gem 'omniauth'
gem 'omniauth-google-oauth2'
gem 'omniauth-facebook'

gem 'httparty'
gem 'rpush'
</code></pre>

<p>Same thing is working on <code>localhost</code>(<code>development mode</code>) . But not on live server (<code>production mode</code>) .And i'm pretty sure that <code>redirect urls</code> set on <code>Google developer console</code> is correct because it's hitting on server after redirect (as shown in logs above) .I'm also sure about <code>routes</code> as they are handling the response in development mode .I also give a shot to <code>Bundle update</code> , But , no use</p>