tokland / youtube-upload

Upload videos to Youtube from the command line
2.06k stars 464 forks source link

[FlowExchangeError] invalid_clientThe OAuth client was not found #331

Closed pavzagor closed 2 years ago

pavzagor commented 3 years ago

Describe the bug [FlowExchangeError] invalid_clientThe OAuth client was not found.

To Reproduce Steps to reproduce the behavior:

  1. Install dependencies (sudo pip install --upgrade google-api-python-client oauth2client progressbar2) ↓ Requirement already satisfied: google-api-python-client in /usr/local/lib/python3.9/site-packages (2.8.0) Requirement already satisfied: oauth2client in /usr/local/lib/python3.9/site-packages (4.1.3) Requirement already satisfied: progressbar2 in /usr/local/lib/python3.9/site-packages (3.53.1) Requirement already satisfied: six<2dev,>=1.13.0 in /usr/local/lib/python3.9/site-packages (from google-api-python-client) (1.16.0) Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /usr/local/lib/python3.9/site-packages (from google-api-python-client) (3.0.1) Requirement already satisfied: google-api-core<2dev,>=1.21.0 in /usr/local/lib/python3.9/site-packages (from google-api-python-client) (1.30.0) Requirement already satisfied: google-auth-httplib2>=0.1.0 in /usr/local/lib/python3.9/site-packages (from google-api-python-client) (0.1.0) Requirement already satisfied: google-auth<2dev,>=1.16.0 in /usr/local/lib/python3.9/site-packages (from google-api-python-client) (1.30.2) Requirement already satisfied: httplib2<1dev,>=0.15.0 in /usr/local/lib/python3.9/site-packages (from google-api-python-client) (0.19.1) Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in /usr/local/lib/python3.9/site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client) (2.25.1) Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in /usr/local/lib/python3.9/site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client) (1.53.0) Requirement already satisfied: setuptools>=40.3.0 in /usr/local/lib/python3.9/site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client) (56.0.0) Requirement already satisfied: pytz in /usr/local/lib/python3.9/site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client) (2021.1) Requirement already satisfied: packaging>=14.3 in /usr/local/lib/python3.9/site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client) (20.9) Requirement already satisfied: protobuf>=3.12.0 in /usr/local/lib/python3.9/site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client) (3.17.3) Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.9/site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client) (4.2.2) Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.9/site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client) (0.2.8) Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.9/site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client) (4.7.2) Requirement already satisfied: pyparsing<3,>=2.4.2 in /usr/local/lib/python3.9/site-packages (from httplib2<1dev,>=0.15.0->google-api-python-client) (2.4.7) Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.9/site-packages (from pyasn1-modules>=0.2.1->google-auth<2dev,>=1.16.0->google-api-python-client) (0.4.8) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client) (1.26.5) Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.9/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client) (4.0.0) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.9/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client) (2.10) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client) (2021.5.30) Requirement already satisfied: python-utils>=2.3.0 in /usr/local/lib/python3.9/site-packages (from progressbar2) (2.5.6)

  2. Clone repo (git clone https://github.com/tokland/youtube-upload.git)

  3. Go into the cloned repo folder (cd youtube-upload)

  4. run the setup file (sudo python setup.py install)

  5. Creare credentials( https://console.cloud.google.com/apis/credentials image image image image image image

  6. Go to the folder w videos (cd Documents/Zoom/)

  7. launch youtube upload (youtube-upload --title "test" video.mp4) Using client secrets: /Users/pavelzagorodnikh/.client_secrets.json Using credentials file: /Users/pavelzagorodnikh/.youtube-upload-credentials.json /usr/local/lib/python3.9/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access /Users/pavelzagorodnikh/.youtube-upload-credentials.json: No such file or directory warnings.warn(_MISSING_FILE_MESSAGE.format(filename)) Check this link in your browser: https://accounts.google.com/o/oauth2/auth?client_id=YOUR+CLIENT+ID&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.upload+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&access_type=offline&response_type=code

  8. Copy the unaltered link to the address bar and hit return (https://accounts.google.com/o/oauth2/auth?client_id=YOUR+CLIENT+ID&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.upload+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&access_type=offline&response_type=code) image

  9. Copy the same link but replace YOUR+CLIENT+ID with client ID from client_secrets.json → visit image

  10. Choose the account to which the credentials were issued

  11. Choose the channel image image image

  12. Grant permissions image image image

  13. Copy sign-in code and paste to the terminal → hit enter image

  14. Get FlowExchangeError [FlowExchangeError] invalid_clientThe OAuth client was not found. image

Expected behavior Successful authorization. The script is now able to upload videos.

Desktop (please complete the following information):

Additional context About window screenshot image

authentication error can't authenticate 401 error

Alyetama commented 3 years ago
  1. Rename your "client_secrets.json" to ==> ".client_secrets.json".
  2. Visit the APIs & Services page of your project (youtube-upload).
  3. Go to OAuth consent screen.
  4. Depending on what you have done before, you will either: a. Go to +Add users, under test users add the users for the test (your email address in this case). b. and/or "publish app".

Run the main script again, copy the URL in the output and paste it directly in the browser. You will be prompted to sign in to get the verification key.

pavzagor commented 2 years ago

The renaming helped (had to rename via mv not the gui)

now it says «Using client secrets: /Users/pavelzagorodnikh/.client_secrets.json Using credentials file: /Users/pavelzagorodnikh/.youtube-upload-credentials.json»

Nothing happens after that/

pavzagor commented 2 years ago

Everything is working now

Thanks a lot! God I love the developers community