{"action":"opened","issue":{"url":"https://api.github.com/repos/coursera/courseraoauth2client/issues/4","repository_url":"https://api.github.com/repos/coursera/courseraoauth2client","labels_url":"https://api.github.com/repos/coursera/courseraoauth2client/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/coursera/courseraoauth2client/issues/4/comments","events_url":"https://api.github.com/repos/coursera/courseraoauth2client/issues/4/events","html_url":"https://github.com/coursera/courseraoauth2client/issues/4","id":183721220,"number":4,"title":"OAuth2 Protocol Exception: Unexpected status code from token endpoint ","user":{"login":"anilmuppalla","id":321785,"avatar_url":"https://avatars.githubusercontent.com/u/321785?v=3","gravatar_id":"","url":"https://api.github.com/users/anilmuppalla","html_url":"https://github.com/anilmuppalla","followers_url":"https://api.github.com/users/anilmuppalla/followers","following_url":"https://api.github.com/users/anilmuppalla/following{/other_user}","gists_url":"https://api.github.com/users/anilmuppalla/gists{/gist_id}","starred_url":"https://api.github.com/users/anilmuppalla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anilmuppalla/subscriptions","organizations_url":"https://api.github.com/users/anilmuppalla/orgs","repos_url":"https://api.github.com/users/anilmuppalla/repos","events_url":"https://api.github.com/users/anilmuppalla/events{/privacy}","received_events_url":"https://api.github.com/users/anilmuppalla/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-18T15:29:55Z","updated_at":"2016-10-18T15:29:55Z","closed_at":null,"body":"I tried the suggestion [here](https://github.com/coursera/courseraprogramming/issues/67) and I am posting the result here as suggested : @zhaojunz \r\n\r\ncourseraoauth2client --verbose config authorize --app manage_research_exports \r\nDEBUG:root:About to read from local file cache file /home/mak/.coursera/manage_research_exports_oauth2_cache.pickle\r\nDEBUG:root:Loaded from file system: {'token': u'CiAAeVJQPzCvREl40e5lhkLtES_wBtFH4R3icFhsKjEo-xIlCMiCBBiBgICAICCBjpLT-yoqELAxwvDX6fm9VzG82cfFmuN4AA', 'expires': 1476302732.911909, 'refresh': u'VQ--yO06FRdjgqK-NJYSlvM6qTuQo1GkAp1zZTkgVBQ'}\r\nDEBUG:root:Attempting to use a refresh token.\r\nDEBUG:root:Posting form data {'client_secret': '', 'grant_type': 'refresh_token', 'client_id': 'sDHC8Nfp-b1XMbzZx8Wa4w', 'refresh_token': u'VQ--yO06FRdjgqK-NJYSlvM6qTuQo1GkAp1zZTkgVBQ'} to token endpoint https://accounts.coursera.org/oauth2/v1/token\r\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): accounts.coursera.org\r\nDEBUG:requests.packages.urllib3.connectionpool:\"POST /oauth2/v1/token HTTP/1.1\" 400 None\r\nDEBUG:root:Response from token endpoint: (400) {\"msg\":\"Invalid Code\"}\r\nERROR:root:Encountered unexpected status code: 400 <Response [400]> {\"msg\":\"Invalid Code\"}\r\nERROR:root:Encountered an exception during refresh token flow.\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/oauth2.py\", line 428, in _exchange_refresh_tokens\r\n    tokens = self._request_tokens_from_token_endpoint(refresh_form)\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/oauth2.py\", line 325, in _request_tokens_from_token_endpoint\r\n    raise OAuth2Exception('Unexpected status code from token endpoint')\r\nOAuth2Exception: OAuth2 Protocol Exception: Unexpected status code from token endpoint\r\nINFO:root:Attempting to retrieve new tokens from the endpoint. You will be prompted to authorize yourapp in your web browser.\r\nINFO:root:About to request new OAuth2 tokens from Coursera.\r\nDEBUG:root:Constructed authoriation request at: https://accounts.coursera.org/oauth2/v1/auth?access_type=offline&state=ebb9097e0a93490e84c2f906887a9e33&redirect_uri=http%3A%2F%2Flocalhost%3A9876%2Fcallback&response_type=code&client_id=sDHC8Nfp-b1XMbzZx8Wa4w&scope=view_profile\r\nPlease visit the following URL to authorize this app:\r\n\thttps://accounts.coursera.org/oauth2/v1/auth?access_type=offline&state=ebb9097e0a93490e84c2f906887a9e33&redirect_uri=http%3A%2F%2Flocalhost%3A9876%2Fcallback&response_type=code&client_id=sDHC8Nfp-b1XMbzZx8Wa4w&scope=view_profile\r\n\r\n127.0.0.1 - - [18/Oct/2016 11:26:46] \"GET /callback?state=ebb9097e0a93490e84c2f906887a9e33&code=jzMkyCIBrzFMqWiJWTXD8pe8MIDsQ9Es-9MzsjtGcWo HTTP/1.1\" 200 -\r\nDEBUG:root:Posting form data {'client_secret': '', 'code': 'jzMkyCIBrzFMqWiJWTXD8pe8MIDsQ9Es-9MzsjtGcWo', 'grant_type': 'authorization_code', 'client_id': 'sDHC8Nfp-b1XMbzZx8Wa4w', 'redirect_uri': 'http://localhost:9876/callback'} to token endpoint https://accounts.coursera.org/oauth2/v1/token\r\nINFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): accounts.coursera.org\r\nDEBUG:requests.packages.urllib3.connectionpool:\"POST /oauth2/v1/token HTTP/1.1\" 400 None\r\nDEBUG:root:Response from token endpoint: (400) {\"msg\":\"Invalid Code\"}\r\nERROR:root:Encountered unexpected status code: 400 <Response [400]> {\"msg\":\"Invalid Code\"}\r\nERROR:root:Problem when running command. Sorry!\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/main.py\", line 64, in main\r\n    return args.func(args)\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/commands/config.py\", line 37, in authorize\r\n    oauth2_instance.build_authorizer()\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/oauth2.py\", line 452, in build_authorizer\r\n    new_tokens = self._authorize_new_tokens()\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/oauth2.py\", line 415, in _authorize_new_tokens\r\n    return self._request_tokens_from_token_endpoint(form_data)\r\n  File \"/usr/local/lib/python2.7/dist-packages/courseraoauth2client/oauth2.py\", line 325, in _request_tokens_from_token_endpoint\r\n    raise OAuth2Exception('Unexpected status code from token endpoint')\r\nOAuth2Exception: OAuth2 Protocol Exception: Unexpected status code from token endpoint\r\n"}}
{"actor":{"display_login":"anilmuppalla"}}