Im new to Google adwords - My client center. I have a website to view all the MCC Campaigns, Adgroups, ads etc with Yii framework. It is working fine.
My problem is, if the Mcc Email or Password or Client Id is invalid, it show the error like the below code.
Failed to get authToken. Reason: BadAuthentication
$response = $this->Login();
095 $fields = $this->ParseResponse($response);
096 if (array_key_exists('Error', $fields)) {
097 $error = $fields['Error'];
098 if (array_key_exists('Info', $fields)) {
099 $error .= ': ' . $fields['Info'];
100 }
101 $url = array_key_exists('Url', $fields) ? $fields['Url'] : NULL;
102 $captchaToken = array_key_exists('CaptchaToken', $fields) ?
103 $fields['CaptchaToken'] : NULL;
104 $captchaUrl = array_key_exists('CaptchaUrl', $fields) ?
105 $fields['CaptchaUrl'] : NULL;
106 throw new AuthTokenException($error, $url, $captchaToken, $captchaUrl);
107 } else if (!array_key_exists('Auth', $fields)) {
108 throw new AuthTokenException('Unknown');
109 } else {
110 return $fields['Auth'];
111 }
112 }
113
114 /**
115 * Makes the client login request and stores the result.
116 * @return string the response from the ClientLogin API
117 * @throws AuthTokenException if an error occurs during authentication
118 */
But i want display the error as "Your Account is invalid". Please advice where i can write the condition to check the account is valid.
Im not having much idea about this. I searched for the google adwords api client library and found the following "http://code.google.com/p/google-api-adwords-php/downloads/list". After that, downloaded the aw_api_php_lib_3.2.2.tar.gz and placed that code in "mysite/protected/" folder. And i have modified configuration in "mysite/protected/adwords/src/Google/Api/Ads/AdWords/auth.ini" file.
In views file [mysite/protected/views/site/view.php], i have called the Adwords function as,
Yii::import('application.adwords.*');
require_once('examples/v201206/BasicOperations/GetCampaigns.php')
$user = new AdWordsUser();
$user->LogAll();
$result_camp = GetCampaignsExample($user);
It returns all campaigns. But if i provided the wrong configuration details, it shows the above error [Failed to get authToken. Reason: BadAuthentication]. I want to display the error in specified format. Please advice.