I am testing the python-youtube package, using the following code:
from pyyoutube import Api
api = Api(
client_id="yes-my-client-id-here-i-know",
client_secret="yes-my-client-secret-here-i-know")
authorization_url = api.get_authorization_url()
access_token = api.generate_access_token(authorization_response=authorization_url[0])
print('authorization_url : >>>>>> ', authorization_url)
print('access_token : >>>>>> ', access_token)
I get the following error.
Traceback (most recent call last):
File "main.py", line 10, in <module>
access_token = api.generate_access_token(authorization_response=authorization_url[0])
File "/Users/sleento/production/python-youtube-api/env/lib/python3.8/site-packages/pyyoutube/api.py", line 263, in generate_access_token
token = oauth_session.fetch_token(
File "/Users/sleento/production/python-youtube-api/env/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 244, in fetch_token
self._client.parse_request_uri_response(
File "/Users/sleento/production/python-youtube-api/env/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/web_application.py", line 220, in parse_request_uri_response
response = parse_authorization_code_response(uri, state=state)
File "/Users/sleento/production/python-youtube-api/env/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 284, in parse_authorization_code_response
raise MissingCodeError("Missing code parameter in response.")
oauthlib.oauth2.rfc6749.errors.MissingCodeError: (missing_code) Missing code parameter in response.
I solve that, I was using
client_id
instead ofapi_key
parameter.