invalid_client in google oauth2

匿名 (未验证) 提交于 2019-12-03 02:11:02

问题:

I try to make a web page for youtube video upload, therefore I try to get the client id from google api console, and in the api console it shows something like this:

Client ID: 533832195920.apps.googleusercontent.com Redirect URIs: http://bobyouku.ap01.aws.af.cm/testyoutube.php https://developers.google.com/oauthplayground

However when I try to test my account using the following URL:

https://accounts.google.com/o/oauth2/auth?client_id=533832195920.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Fbobyouku.ap01.aws.af.cm%2Ftestyoutube.php&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&response_type=code&access_type=offline

It gives out the result of invalid_client. Even when I try it on oauth2 playground, same fail occurs

So anyone knows what's happen?

回答1:

Set/change your product name, I had this issue until I created a product name as same as project name.

The product name can be set in the Consent screen section of the Google Developers Console for your project. Look under APIs & auth in the left navigation and select Consent screen. You need also to set your email address in the box above the product name.



回答2:

After copy values from Google web UI, I had a blank space for:

  • client_id
  • secret

And at the BEGINNING and at the END for both.



回答3:

Trim the leading and trailing white space from both the client_id and client_secret. Google's copy button does not do this for you.

Set both the email address and product name fields for the OAuth consent screen.



回答4:

Setting EMAIL ADDRESS and PRODUCT NAME in the consent screen of Google developer console, solves the error "Error: invalid_client. The OAuth client was not found." for me.



回答5:

in this thread i found my answer.

  1. I went to google console,
  2. generate a new project, made refresh, because in my case after create the page didn't reload
  3. select new project
  4. create a client ID
  5. use it for what you need

thanks guys :D



回答6:

In my case this turned out to be something else, namely my code used an environment variable that hadn't been set properly (and stupidly wasnt checked by my code). Setting it, recompiling assets, and restarting the app did the trick.



回答7:

I had .apps.googleusercontent.com twice in my ID.

It was a copy and paste issue "Your ID HERE".apps.googleusercontent.com



回答8:

invalid_client can also simply means that your client ID and client secret are wrong when you create your Oauth2 object.



回答9:

Did the error also report that it was missing an application name? I had this issue until I created a project name (e.g. "Project X") in the project settings dialog.



回答10:

I solved this by removing unnecessary quotes from my clientID and clientSecret values.



回答11:

probably old credentials are invalid

see the answer below

stackoverflow answer

or short names may work

see the answer below stackoverflow answer

or product name same as project name as answered already

at times one may include extra space in the

check twice this line so that you are redirected to the correct url



回答12:

Check your Project name on Google APIs console. you choose another project you created. I was same error. my mistake was choosing diffirent project.



回答13:

At Credentials Accept requests from these HTTP referrers (web sites) (Optional) Use asterisks for wildcards. If you leave this blank, requests will be accepted from any referrer. Be sure to add referrers before using this key in production. Add . (star dot star) . It work fine for me



回答14:

I accidentally had a value in the Client Secret part of the URL, but Google Credential does not need a Client Secret for Android OAuth 2 Client IDs. Simply leaving the value blank in the URL did the trick for me.



回答15:

Steps that worked for me:

  1. Delete credentials that are not working for you
  2. Create new credentials with some NAME
  3. Fill in the same NAME on your OAuth consent screen
  4. Fill in the e-mail address on the OAuth consent screen

The name should be exactly the same.



回答16:

Another thing to check:

When you install the GoogleAPIs into a .Net app with NuGet, it will inject a new set of dummy values in your *.config file.

Check that any original values are still in place, and remove dummy entries.



回答17:

I solved my problem with trim :

'google' => [     'client_id' =>trim('client_id),     'client_secret' => trim('client_secret'),     'redirect' => 'http://localhost:8000/login/google/callback', ],


回答18:

None of the following were my issue - I resolved this by opening an incognito window. Something was obviously being cached somewhere, no amount of changing auth client settings helped and there were never any trailing or leading spaces in config values.



回答19:

Deleting client ID and creating new one a couple of times worked for me.



转载请标明出处:invalid_client in google oauth2
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!