diff --git a/pydrive/auth.py b/pydrive/auth.py index e0b7e58..c8cb941 100644 --- a/pydrive/auth.py +++ b/pydrive/auth.py @@ -504,8 +504,10 @@ def Authenticate(self, code): """ if self.flow is None: self.GetFlow() + if self.http is None: + self.http = httplib2.Http(timeout=self.http_timeout) try: - self.credentials = self.flow.step2_exchange(code) + self.credentials = self.flow.step2_exchange(code, http=self.http) except FlowExchangeError as e: raise AuthenticationError('OAuth2 code exchange failed: %s' % e) print('Authentication successful.')