LearnatHome / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

OAuth2WebServerFlow should have option to retrieve original response data #220

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In OAuth2WebServerFlow.step2_exchange, it would be great if there was a way to 
access the original response data with the access_token for cases where the 
oauth2 server includes additional information in the access_token exchange e.g. 
Salesforce.

To be more specific, in the authorization step Salesforce responds with 
information regarding which server endpoint the client should hit to use the 
api, in addition to the usual oauth2 response (access_token, refresh_token, 
etc). This is lost in the current method as there is no way to access the 
original response data.
See part 5 of 
http://www.salesforce.com/us/developer/docs/api_rest/Content/intro_understanding
_web_server_oauth_flow.htm.

Original issue reported on code.google.com by yorinasu...@gmail.com on 16 Nov 2012 at 2:02

GoogleCodeExporter commented 9 years ago
You can get access to the full body of the response by wrapping the httplib2 
request in a closure that will see the full request/response. There are some 
examples included in the client library, see set_user_agent or tunnel_patch:

http://google-api-python-client.googlecode.com/hg/docs/epy/apiclient.http-module
.html#set_user_agent

Here is patch to the Google+ sample that does just that, printing out the full 
exchange response:

   https://codereview.appspot.com/6856053/diff/1/samples/plus/plus.py

Original comment by jcgregorio@google.com on 16 Nov 2012 at 9:15