lib/omniauth/strategies/fellowshipone.rb
# Override the callback phase so that we can use our own request token
# (FellowshipOneRequestToken) instead of OAuth::RequestToken.
#
# Adapted from OmniAuth::Strategies::OAuth::callback_phase
Override the callback phase so that we can use our own request token
(FellowshipOneRequestToken) instead of OAuth::RequestToken.


Override the callback phase so that we can use our own request token ( FellowshipOneRequestToken ) instead of OAuth :: RequestToken .
def callback_phase
        raise OmniAuth::NoSessionError.new("Session Expired") if session['oauth'].nil?
        request_token = FellowshipOneRequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret'))
        opts = {}
        if session['oauth'][name.to_s]['callback_confirmed']
          opts[:oauth_verifier] = request['oauth_verifier']
        else
          opts[:oauth_callback] = callback_url
        end
        @access_token = request_token.get_access_token(opts)
        self.env['omniauth.auth'] = auth_hash
        call_app!
      rescue ::Timeout::Error => e
        fail!(:timeout, e)
      rescue ::Net::HTTPFatalError, ::OpenSSL::SSL::SSLError => e
        fail!(:service_unavailable, e)
      rescue ::OAuth::Unauthorized => e
        fail!(:invalid_credentials, e)
      rescue ::NoMethodError, ::MultiJson::DecodeError => e
        fail!(:invalid_response, e)
      rescue ::OmniAuth::NoSessionError => e
        fail!(:session_expired, e)
      end
def callback_phase raise OmniAuth :: NoSessionError . new ( "Session Expired" ) if session [ 'oauth' ] . nil? request_token = FellowshipOneRequestToken . new ( consumer , session [ 'oauth' ] [ name . to_s ] . delete ( 'request_token' ) , session [ 'oauth' ] [ name . to_s ] . delete ( 'request_secret' ) ) opts = { } if session [ 'oauth' ] [ name . to_s ] [ 'callback_confirmed' ] opts [ :oauth_verifier ] = request [ 'oauth_verifier' ] else opts [ :oauth_callback ] = callback_url end @access_token = request_token . get_access_token ( opts ) self . env [ 'omniauth.auth' ] = auth_hash call_app! rescue :: Timeout :: Error => e fail! ( :timeout , e ) rescue :: Net :: HTTPFatalError , :: OpenSSL :: SSL :: SSLError => e fail! ( :service_unavailable , e ) rescue :: OAuth :: Unauthorized => e fail! ( :invalid_credentials , e ) rescue :: NoMethodError , :: MultiJson :: DecodeError => e fail! ( :invalid_response , e ) rescue :: OmniAuth :: NoSessionError => e fail! ( :session_expired , e ) end
Override the callback phase so that we can use our own request token
(FellowshipOneRequestToken) instead of OAuth::RequestToken.
Override the callback phase so that we can use our own request token ( FellowshipOneRequestToken ) instead of OAuth :: RequestToken .
# IMPORTANT: DO NOT REMOVE THIS! WE DO NOT WANT TO CALL # OmniAuth::Strategies::OAuth::callback_phase here! So, we must copy # OmniAuth::Strategy::callback_phase here # super