KoalaTea / google-api-python-client

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

Check for error (or missing code) in step2_exchange #135

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start an OAuth 2 dance with a provider (e.g. foursquare) in a situation 
where you'll get an error redirect (e.g. mismatched callback URL from the one 
you pre-registered)
2. When the user is redirected back to your callback page, call 
flow.step2_exchange(self.request.params) to start the exchange

What is the expected output? What do you see instead?
Expected:
- oauth2 client code defensively checks if 'code' is present as a parameter
- if not, it raises a FlowExchangeError
- also looks for 'error' param, and uses it if present as error_msg (e.g. 
foursquare sends ?error=redirect_uri_mismatch)
Actual:
- oauth2 client code blindly tries to access code['code'], which results in a 
KeyError being raised
- error message sent by provider is never relayed to developer

What version of the product are you using? On what operating system?
oauth2client 1.0b9

Please provide any additional information below.
I can send a patch if desired (not sure on the process/logistics for that, but 
it's a simple change). Thanks!

Original issue reported on code.google.com by jsmarr@google.com on 22 May 2012 at 12:05

GoogleCodeExporter commented 8 years ago
CL out for review: http://codereview.appspot.com/6306085/

Original comment by jcgregorio@google.com on 14 Jun 2012 at 7:57

GoogleCodeExporter commented 8 years ago
Fixed in 
http://code.google.com/p/google-api-python-client/source/detail?r=e283dfe361a674
2f621f4699a81c23d78a3bcc12

Original comment by jcgregorio@google.com on 14 Jun 2012 at 8:18