32

I am working with Google Drive File Picker by following this Google Drive File Picker Example demo project. I have generated API Key and Client Id. But when I run the project I am getting following error

  1. That’s an error.

Error: invalid_client

The OAuth client was not found.

I have also checked This Google Drive File Picker Example Link but it does not work, Please help me to solve my issue.

invalid_client in google oauth2.

enter image description here

Community
  • 1
  • 1
user3653474
  • 3,393
  • 6
  • 49
  • 135

10 Answers10

19

Your client_id is not correct, re-check pls

6

enter image description here

In the following pic, I made with restricted mode in API keys section. This helped me to to remove the display. Hence finally, shown as:

No API keys to display

Try to validate the client_id with those that you created for your project as:

https://console.developers.google.com/google/maps-apis/credentials?folder=&organizationId=&project=saml-281612

The project name, like in my case, it is saml, should match with the project apps as saml to mitigate mismatch_uri error.

This helped me to remove all those errors as:

1. Error 400 : mismatch_uri
2. Error 401 : invalid client_id  
Ank_247shbm
  • 512
  • 7
  • 17
6

In my case, i mistakenly add a , in the values in my .env files so better check that file

# check the comma at the end
AUTH_CLIENT_SECRET=randomauthsecret,
AUTH_CLIENT_ID=randomclientid, 

That causes the wrong client id value. So just remove the ,. Another thing, also don't enclose them in quotes.

AUTH_CLIENT_SECRET=randomauthsecret
AUTH_CLIENT_ID=randomclientid
The.Wolfgang.Grimmer
  • 1,172
  • 2
  • 9
  • 32
  • 1
    Yeah in my case, I entered client_id where api_key was supposed to be and vice versa and I wasted my 20 minutes. Thanks for saving me some time. – Savitoj Cheema Mar 10 '21 at 07:15
4

you may be getting this error if you are already logged in to a google account on your system so log out of all accounts and then run the code

afrin
  • 41
  • 1
2

It worked for me after I removed the quotation marks I had set in my environment variable

Vikrant Bhat
  • 2,117
  • 2
  • 14
  • 32
2

The problem was how vscode format the code, it leaves spaces within the client_id, so I used atom to write the client_id in the .env file and ran app.js through hyper. It worked.

oraUnix99
  • 21
  • 1
1

Also facing the same issue and wasted half an hour, the thing that worked for me was creating a new credential and replacing old credential in code with new.

And then it was working as expected

  • Brevity is great, but only when brevity is able to achieve a clear and concise answer. This answer lacks any sort of explanation &/or example. – JΛYDΞV Jul 14 '21 at 16:05
1

May be values are not correct in .env file for "Client ID" and "Client secret" or mistake of using "," in file.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 07 '22 at 01:28
0

I had the same issue sometimes back what helped was adding a space when passing the client id.

  • 2
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 03 '22 at 13:16
  • This was my problem: VS 2022 * performs autoformatting when pasting into code outside "". Part of this formatting is to separate "-" from other characters with space. – hardyVeles May 12 '22 at 16:41
0

check if there is a semi-colon or comma at the end of your dotenv(.dotnv) file

AUTH_CLIENT_SECRET=randomauthsecret; AUTH_CLIENT_ID=randomclientid,