I'm trying to create a playlist:
#Importsfrom google.oauth2.credentials import Credentialsfrom googleapiclient.discovery import buildimport json#Load secretswith open('client_secret_XXXX.apps.googleusercontent.com.json', 'r') as f: info = json.load(f)#Credentialscreds = Credentials.from_authorized_user_info(info=info, scopes=["https://www.googleapis.com/auth/youtube"])#APIyoutube = build('youtube', 'v3', credentials=creds)#Create playlistyoutube.playlists().insert( part='snippet', body={'snippet': {'title': 'MyNewPlaylistTest','privacyStatus': 'private' } }).execute()
The error that appears:
Traceback (most recent call last): File "x.py", line 9, in creds = Credentials.from_authorized_user_info(info=info, scopes=["https://www.googleapis.com/auth/youtube"]) File "y.py",line 352, in from_authorized_user_inforaise ValueError( ValueError: Authorized user info was not in the expected format, missing fields client_secret, client_id,refresh_token.
I'm using the json credentials from the Client ID in OAuth2.0 in my google cloud.
--
Content of the client secret json:
{"installed":{"client_id":"XXXX.apps.googleusercontent.com","project_id":"YYYYYYYY-XXXX","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"XXXXX/oauth2/v1/certs","client_secret":"XXXXXXXX","redirect_uris":["http://XXXXX"] } }