44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/omniauth/strategies/google_chrome_identity.rb', line 44
def callback_phase
if !request.params['access_token'] || request.params['access_token'].to_s.empty?
raise ArgumentError.new("No access token provided.")
end
self.access_token = build_access_token
self.access_token = self.access_token.refresh! if self.access_token.expired?
self.env['omniauth.auth'] = auth_hash
call_app!
rescue ::OAuth2::Error => e
fail!(:invalid_credentials, e)
rescue ::MultiJson::DecodeError => e
fail!(:invalid_response, e)
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
fail!(:timeout, e)
rescue ::SocketError => e
fail!(:failed_to_connect, e)
end
|