{"action":"created","issue":{"url":"https://api.github.com/repos/burnash/gspread/issues/237","labels_url":"https://api.github.com/repos/burnash/gspread/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/burnash/gspread/issues/237/comments","events_url":"https://api.github.com/repos/burnash/gspread/issues/237/events","html_url":"https://github.com/burnash/gspread/issues/237","id":81439141,"number":237,"title":"Oauth2 Not working","user":{"login":"jonathanng","id":2832171,"avatar_url":"https://avatars.githubusercontent.com/u/2832171?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanng","html_url":"https://github.com/jonathanng","followers_url":"https://api.github.com/users/jonathanng/followers","following_url":"https://api.github.com/users/jonathanng/following{/other_user}","gists_url":"https://api.github.com/users/jonathanng/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanng/subscriptions","organizations_url":"https://api.github.com/users/jonathanng/orgs","repos_url":"https://api.github.com/users/jonathanng/repos","events_url":"https://api.github.com/users/jonathanng/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-27T13:14:06Z","updated_at":"2015-05-27T15:15:45Z","closed_at":null,"body":"I'm on Windows, using Python 2.7. I've updated gspread and oauth2client-1.4.11.\r\n\r\nI followed the steps [here](https://github.com/burnash/gspread/issues/224).\r\n\r\nMy preference would to not do the solution [here](https://github.com/burnash/gspread/issues/224), as I would really like to keep all my keys, passwords, etc on a single file.\r\n\r\nMy code:\r\n\r\n    GOOGLE_SPREADSHEET_CLIENT_EMAIL = '***@developer.gserviceaccount.com'\r\n    GOOGLE_SPREADSHEET_PRIVATE_KEY  = \"-----BEGIN PRIVATE KEY-----\\n***\\n-----END PRIVATE KEY-----\\n\"\r\n\r\n    def account():\r\n\r\n        credentials = SignedJwtAssertionCredentials(\r\n            service_account_name = GOOGLE_SPREADSHEET_CLIENT_EMAIL,\r\n            private_key          = GOOGLE_SPREADSHEET_PRIVATE_KEY,\r\n            scope                = ['https://spreadsheets.google.com/feeds']\r\n        )\r\n\r\n        return gspread.authorize(credentials)\r\n\r\n        # return gspread.login(\r\n        #     settings.GOOGLE_SPREADSHEET_USERNAME,\r\n        #     settings.GOOGLE_SPREADSHEET_PASSWORD\r\n        # )\r\n\r\nError:\r\n\r\n        c:\\development\\test\\google_spreadsheets.pyc in account()\r\n           16     )\r\n           17 \r\n        ---> 18     return gspread.authorize(credentials)\r\n           19 \r\n           20     # return gspread.login(\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\gspread\\client.pyc in authorize(credentials)\r\n          333     \"\"\"\r\n          334     client = Client(auth=credentials)\r\n        --> 335     client.login()\r\n          336     return client\r\n          337 \r\n\r\n        C:\\Anaconda\\lib\\site-packages\\gspread\\client.pyc in login(self)\r\n           96 \r\n           97                 http = httplib2.Http()\r\n        ---> 98                 self.auth.refresh(http)\r\n           99 \r\n          100             self.session.add_header('Authorization', \"Bearer \" + self.auth.access_token)\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\oauth2client\\client.pyc in refresh(self, http)\r\n          596         request.\r\n          597     \"\"\"\r\n        --> 598     self._refresh(http.request)\r\n          599 \r\n          600   def revoke(self, http):\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\oauth2client\\client.pyc in _refresh(self, http_request)\r\n          767     \"\"\"\r\n          768     if not self.store:\r\n        --> 769       self._do_refresh_request(http_request)\r\n          770     else:\r\n          771       self.store.acquire_lock()\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\oauth2client\\client.pyc in _do_refresh_request(self, http_request)\r\n          793       AccessTokenRefreshError: When the refresh fails.\r\n          794     \"\"\"\r\n        --> 795     body = self._generate_refresh_request_body()\r\n          796     headers = self._generate_refresh_request_headers()\r\n          797 \r\n\r\n        C:\\Anaconda\\lib\\site-packages\\oauth2client\\client.pyc in _generate_refresh_request_body(self)\r\n         1423 \r\n         1424   def _generate_refresh_request_body(self):\r\n        -> 1425     assertion = self._generate_assertion()\r\n         1426 \r\n         1427     body = urllib.parse.urlencode({\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\oauth2client\\client.pyc in _generate_assertion(self)\r\n         1552     private_key = base64.b64decode(self.private_key)\r\n         1553     return crypt.make_signed_jwt(crypt.Signer.from_string(\r\n        -> 1554         private_key, self.private_key_password), payload)\r\n         1555 \r\n         1556 # Only used in verify_id_token(), which is always calling to the same URI\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\oauth2client\\crypt.pyc in from_string(key, password)\r\n          163       parsed_pem_key = _parse_pem_key(key)\r\n          164       if parsed_pem_key:\r\n        --> 165         pkey = crypto.load_privatekey(crypto.FILETYPE_PEM, parsed_pem_key)\r\n          166       else:\r\n          167         if isinstance(password, six.text_type):\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\OpenSSL\\crypto.pyc in load_privatekey(type, buffer, passphrase)\r\n         2008 \r\n         2009     if evp_pkey == _ffi.NULL:\r\n        -> 2010         _raise_current_error()\r\n         2011 \r\n         2012     pkey = PKey.__new__(PKey)\r\n\r\n        C:\\Anaconda\\lib\\site-packages\\OpenSSL\\_util.pyc in exception_from_error_queue(exceptionType)\r\n           20                 text(lib.ERR_reason_error_string(error))))\r\n           21 \r\n        ---> 22     raise exceptionType(errors)\r\n           23 \r\n           24 \r\n\r\n        Error: []\r\n\r\n        > c:\\anaconda\\lib\\site-packages\\openssl\\_util.py(22)exception_from_error_queue()\r\n           21 \r\n        ---> 22     raise exceptionType(errors)\r\n           23 \r\n\r\nThanks for your help!"},"comment":{"url":"https://api.github.com/repos/burnash/gspread/issues/comments/105952368","html_url":"https://github.com/burnash/gspread/issues/237#issuecomment-105952368","issue_url":"https://api.github.com/repos/burnash/gspread/issues/237","id":105952368,"user":{"login":"burnash","id":264674,"avatar_url":"https://avatars.githubusercontent.com/u/264674?v=3","gravatar_id":"","url":"https://api.github.com/users/burnash","html_url":"https://github.com/burnash","followers_url":"https://api.github.com/users/burnash/followers","following_url":"https://api.github.com/users/burnash/following{/other_user}","gists_url":"https://api.github.com/users/burnash/gists{/gist_id}","starred_url":"https://api.github.com/users/burnash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burnash/subscriptions","organizations_url":"https://api.github.com/users/burnash/orgs","repos_url":"https://api.github.com/users/burnash/repos","events_url":"https://api.github.com/users/burnash/events{/privacy}","received_events_url":"https://api.github.com/users/burnash/received_events","type":"User","site_admin":false},"created_at":"2015-05-27T15:15:44Z","updated_at":"2015-05-27T15:15:44Z","body":"Thanks. You might hit the issue with the ssl in the latest Python version (#228). There's a pull request with a fix for it. I haven't test it though. Can you try @danielcb's fix to see if it works for you?\r\n\r\nThis is how you can get it:\r\n\r\n    git clone -b feature-ssl-verification https://github.com/danielcb/gspread.git"}}