Reputation: 237
I am using Adwords API from last 3 months and all of a sudden today it is coming up with error message as follows: Uncaught exception 'AuthTokenException' with message 'Failed to get authToken. Reason: BadAuthentication' I am using google adwords V201101 php library with auth.ini containing all user details and settings.ini with https://adwords.google.com not sandbox environment. Can anyone help me with this please???
Thanks, Murali.
Upvotes: 1
Views: 1777
Reputation: 7762
I started getting this error after somebody in my organization updated the password for the account my app was using to log in. The best way to avoid this happening again is to use OAuth2
.
It's as easy as going to the Google API console and creating a Client ID for Installed Applications (under API access
) for your project. You then use the Client ID and Client Secret in your Adwords API auth.ini
file.
Next you run the examples/AdWords/Auth/GetRefreshToken.php
script which will have you grant your app access to your Adwords account. You'll end up with a Refresh Token which you need to add to your auth.ini
.
The ClientLogin (username and password) method of authentication is being deprecated in favour of the above so best to migrate ASAP.
Upvotes: 0
Reputation: 687
I recently had this problem trying to connect to Google DFP. I copied perfectly working code from my localhost after development and ran it on my remote cloud server. I then received the
Failed to get authToken
message. The reason was that google was blocking the attempted login as a security measure because it was a new location. I had to log into the google account (from the web) with those credentials in order to see the message and confirm the added login location. Everything worked fine after that authorization. I've stumbled across this question and thought that this info may help someone else.
Upvotes: 1
Reputation: 607
BadAuthentication means your username/password is incorrect. May be someone changed the account password, may be auth.ini got modified by mistake.
See detailed error codes here: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Errors
Cheers, Anash
Upvotes: 0
Reputation: 9747
you may requesting authToken from ClientLogin service too many times, that is way you get 'CaptchaRequired'.
Request authToken just for the first time, and then cache it for subsequent requests.
Check this out http://goo.gl/TOX6N
Upvotes: 5