com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request "error" : "invalid_user"

2,218 views
Skip to first unread message

game...@gmail.com

unread,
Dec 27, 2016, 1:34:26 PM12/27/16
to AdWords API Forum
I just applied for AdWords API permission, the test account. After I create the test account,  I collected data via the it and developerToken. However, it shows error as follows. I wanna know the reason for this. 
Is it because that I can only collect data after activating developerToken? 

Exception in thread "main" com.google.api.ads.common.lib.exception.OAuthException: Credential could not be refreshed.
at com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredential(OfflineCredentials.java:178)
at adwords.axis.v201609.basicoperations.GetCampaigns.main(GetCampaigns.java:45)
Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
  "error" : "invalid_user"
}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)
at com.google.api.client.auth.oauth2.Credential.executeRefreshToken(Credential.java:570)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:362)
at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489)
at com.google.api.ads.common.lib.auth.OAuth2Helper.callRefreshToken(OAuth2Helper.java:69)
at com.google.api.ads.common.lib.auth.OfflineCredentials.generateCredential(OfflineCredentials.java:172)
... 1 more

google_...@sina.com

unread,
Dec 27, 2016, 1:35:03 PM12/27/16
to AdWords API Forum

google_...@sina.com

unread,
Dec 27, 2016, 1:35:08 PM12/27/16
to AdWords API Forum

Vishal Vinayak (Adwords API Team)

unread,
Dec 27, 2016, 3:54:12 PM12/27/16
to AdWords API Forum
Hi,

Looks like this error is related to your OAuth credentials and not your developer token. Could you provide me with the steps that you followed to create OAuth credentials? 

Regards,
Vishal, AdWords API Team

ВІталій Мозок

unread,
Jan 3, 2017, 10:23:41 AM1/3/17
to AdWords API Forum
HI Vishal! Sory for my pure engliish. I have same issue.


My steps. 
1. Create project in api console and create credentials type other. clientId and clientSecret
i copied to [OATH2] section in adsapi_php.ini.
2.I turned on all adwords apis in project.
3. I got developer token and copied it with client id to [ADWORDS] 
section in adsapi_php.ini.
4. I also obtained the refresh token using the code found in GetRefreshToken.php and I copied to [OATH2] section in adsapi_php.ini.

But when executing the scripts I get the following 400 response:

Exeption 400 Bad Request` response: { "error": "invalid_client",
"error_description": "Bad Request" } after line $customers =
$customerService->getCustomers();

Thanks!
Reply all
Reply to author
Forward
0 new messages