-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got 400, OAuth2Exception: error" : "invalid_request #162
Comments
Same issue here. auth.ini is apparently out of date. "installed application" is no longer even a type. Google's choices now offered are:
|
Hi @litan1106 - I'll need some more information. Are you using existing OAuth2 credentials that were previously working and have stopped working? Or are you trying to create new ones? Which version of the client library are you using? @kwitte can you describe your situation in more detail as well? The documentation in auth.ini is out of date, yes, and thanks for reporting it, I'll look into fixing it. It's now known as "other" in the dev console. Thanks, |
Hi @vtsao [ ...switched to experimental API, thank you @vtsao ... ] |
Hi Everyone, I'm receiving the same intermittent error in my logs (See below). Our OAuth2 Credentials do still seem to be working apart from the intermittent issue. Library: googleads-php-lib-10 Time of first error: 30-Aug-2016 10:15:03 America/Denver Thank you.
|
@kwitte is the experimental API oauth works fine for you? |
I'm looking into it. Are you guys using AdWords or DFP? Can you give me an example of what service you're calling? I'll try to reproduce. |
I am calling the AdWords API - CustomerService using the v12.0.0 php library. // constructor stuff // method stuff // Get the Manage Customer Service try {
} catch (Exception $e) { |
@litan1106 Yes sir! Now using experimental API with JSON credentials file and service account. (@vtsao Was previously using DFP v201605 LineItemService call via API 10.1.0 and using OAuth client_id/client_secret. Intermittent "invalid_request" error also popped up trying to get a new token as well occassionally.) |
To confirm - this is happening when you're running code from a local machine right? And not just an AWS instance or something like that? |
I'm glad someone also came across this error. I was going to create an issue if I still didn't see one this morning. I ran into the same issue the past two days. I exhausted my options with Google and StackOverflow. Library: googleads-php-lib-12 It is intermittent in terms of failing 5 times in a row, then working a few times in a row then failing again.
I pass in my ini file into the user object and I've used it to call |
@vtsao Never tried from my local machine yesterday. All my 10.1.0 calls always originated from the same single AWS instance (no caching, no multi-host DNS records, no load balancing -- just a bare instance). My experimental API is installed on a different AWS instance. You are a hero for offering to look into this for everyone. |
@vtsao I have two vps instances running in the cloud. And one local instances running in a vagrant. They all got the same error in every other request. OAuth2Exception: error" : "invalid_request" I tried the same request for 5 times, 1 of 5 request worked and got the data from AdWords API. Other 4 requests failed with OAuth2Exception: error" : "invalid_request" |
Thanks for the info all. I'm still unable to reproduce the issue. But since it seems like it's specific to the PHP client library (and works in the experimental version), the only thing I can see so far is that the OAuth2Handler is using an older access token OAuth2 endpoint: Can you guys try manually updating it to this one: for now and see if these issues stop? Reference: https://developers.google.com/identity/protocols/OAuth2InstalledApp#refresh |
@vtsao I get "Error 400 (Not Found)" after I supply my API 10.1.0 GetRefreshToken.php on yesterday's server with the new success code provided by the URL it directs me to. But I only changed the ACCESS_ENDPOINT. Should I change AUTHORIZE_ENDPOINT as well to a v4 URL? |
@vtsao I got 400 after I changed const ACCESS_ENDPOINT = 'https://www.googleapis.com/oauth2/v4/token'; |
curl 'https://www.googleapis.com/oauth2/v4/token' -d 'grant_type=refresh_token&refresh_token=<insert_refresh_token_here>&client_id=<insert_client_id_here>&client_secret=<insert_client_secret_here> I tried the curl with my credential. It worked for me and I got access token from it. { |
I did ten of the curl request, I got access token without error. { |
Thanks @litan1106 it might be a CurlUtils issue with the client library. Let me examine that. |
What version of PHP are you guys using? |
my 10.1.0 API on a server running PHP 5.3.10-1ubuntu3.8 with Suhosin-Patch (cli) |
I am running 12.0.0 with AdWords V201607 "googleads/googleads-php-lib": "~12.0.0", |
@litan1106 what version of PHP specifically are you running? |
@vtsao PHP 7.0.5-2+deb.sury.org~trusty+1 |
Which region are you guys located in, or where are your servers based? |
same issue here I am running 12.0.0 with adwords v201607 php 5.6 and having random oath issues, sometimes it works fine other times it fails with 400 issue. I am hosting on ec2 |
@vtsao my 10.1.0 API on an EC2 server running in us-west-1. My experimental API (which has not yet experienced any issues) runs on an EC2 server running in us-east-1. |
@gregoryagrant can you try making some requests from your local machine to see if you encounter this error as well? I'm still unable to reproduce this issue, so trying to isolate variables. |
the weird thing is, it works on my local windows 10 machine running php on xamp and I cannot reproduce this issue. The server it is running on is running Ubuntu 14.0 serving the application over apache 2 |
Can you try curling to: curl 'https://accounts.google.com/o/oauth2/token' -d 'grant_type=refresh_token&refresh_token=&client_id=&client_secret= from your EC2 instance and see if you can reproduce. |
{ |
@vtsao Your curl command works flawlessly. Meanwhile, on same 10.1.0 server, LineItemService call from yesterday (after undoing your v4 endpoint suggestion) still yields intermittent errors. |
yeah that is what is bugging me. And the errors are random. It does not happen after each call, it's like these 3 work then the other one dies with oauth issue. |
Can one of you run a tcpdump on a request that is failing and we will inspect it. You can send it to us at [email protected]. |
@vtsao I did ten curl requests with the same credentials. No error. curl 'https://accounts.google.com/o/oauth2/token' -d 'grant_type=refresh_token&refresh_token=&client_id=&client_secret= |
Thanks for the information all, we're still investigating this. |
I had yesterday multiple times the "invalid_request" error with OAuth2Exception, while sending thousands of API requests that day. But today it's going smooth again. So maybe it was just a occasional hick up on the Google servers? |
The last error I received was yesterday - 01-Sep-2016 17:20:04 America/Denver like @markvaneijk I'm running requests continually throughout the day and as yet haven't received the error. |
Thanks for the help. The issue has been fixed by the Google Team. |
Thank you! I have no admin rights to test anything other than my own code so I had to twiddle my thumbs and hope everyone could resolve this. |
Thanks for everybody's patience on this and helping out with providing us with information. This was caused by something we were rolling out on our end, that has been reverted now. This client library also wasn't handling the HTTP POST correctly for refreshing an access token. It was sending the HTTP POST as form-data, when it should have just been a regular POST. That's been fixed in the 13.0.0 release: Would highly recommend updating to this release. |
OAuth2Exception {#350 ▼
message: """
{\n
"error" : "invalid_request"\n
}
"""
code: 400
file: "src/Google/Api/Ads/Common/Util/SimpleOAuth2Handler.php"
The text was updated successfully, but these errors were encountered: