New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google OAuth 2 Tutorial raises MissingCodeError #103

Closed
puntonim opened this Issue Jan 16, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@puntonim
Copy link

puntonim commented Jan 16, 2014

The code provided in the Google OAuth 2 tutorial (https://requests-oauthlib.readthedocs.org/en/latest/examples/google.html) gives an exception:

raise MissingCodeError("Missing code parameter in response.")
oauthlib.oauth2.rfc6749.errors.MissingCodeError: Missing code parameter in response.

The problem is not in the web application client that I created with the Google API console, because I wrote another piece of code doing the same thing but using the Python library google-api-python-client and it works.

Any idea?

@puntonim puntonim closed this Jan 17, 2014

@puntonim puntonim reopened this Jan 17, 2014

@puntonim

This comment has been minimized.

Copy link
Author

puntonim commented Jan 17, 2014

My mistake!

I got confused because using:
google.fetch_token(token_url, client_secret=client_secret,
... authorization_response=redirect_response)
it is required that redirect_response is a full url.
While using:
google.fetch_token(token_url, client_secret=client_secret,
... code=redirect_response)
it is required that redirect_response is only the code replied by Google.

@puntonim puntonim closed this Jan 17, 2014

@ib-lundgren

This comment has been minimized.

Copy link
Member

ib-lundgren commented Jan 22, 2014

Glad you found it! You can pass the code directly as well using the "code" keyword argument instead of "authorization_response" if you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment