2013-02-21 4 views
0

Im to Google adwords - My client center 신규입니다. Yii 프레임 워크가있는 모든 MCC 캠페인, 광고 그룹, 광고 등을 볼 수있는 웹 사이트가 있습니다. 잘 작동합니다.유효하지 않은 Google 애드워즈 계정의 오류 표시

내 문제는 MCC 전자 메일이나 암호 또는 클라이언트 ID가 유효하지 않은 경우 아래 코드와 같은 오류가 표시된다는 것입니다.

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 */ 

그러나 "귀하의 계정이 유효하지 않습니다"라는 오류 메시지가 표시됩니다. 계정을 확인하기위한 조건을 작성할 수있는 조언이 유효합니다.

저는 이것에 대해별로 생각하지 않습니다. 나는 Google adwords api 클라이언트 도서관을 찾고 뒤에 오는 것 "http://code.google.com/p/google-api-adwords-php/downloads/list"를 찾아 냈다. 그 후, aw_api_php_lib_3.2.2.tar.gz를 다운로드하고 그 코드를 "mysite/protected /"폴더에 넣습니다. 그리고 "mysite/protected/adwords/src/Google/Api/Ads/AdWords/auth.ini"파일에서 설정을 수정했습니다. 뷰에서

그것은 모든 캠페인을 반환

Yii::import('application.adwords.*'); 
require_once('examples/v201206/BasicOperations/GetCampaigns.php') 
$user = new AdWordsUser(); 
$user->LogAll(); 
$result_camp = GetCampaignsExample($user); 

, [내 사이트/보호/뷰/사이트/view.php], 난 때 애드워즈 기능을 호출 한 파일. 하지만 잘못된 구성 정보를 입력하면 위의 오류가 표시됩니다. [AuthToken을 가져 오지 못했습니다. 이유 : BadAuthentication]. 오류를 지정된 형식으로 표시하려고합니다. 제발 조언.

+0

내 더티 픽스는 AuthTokenException excepto를 잡아서 멋지게 표시하는 것입니다.이 플러그인이나 오류를 throw하는 코드입니까? – DarkMukke

+0

그리고 플러그인을 추측해야합니까? – DarkMukke

+0

@DarkMukke 자세한 내용은 위를 참조하십시오. Im은 어떤 오류가 발생했는지 알지 못합니다. Google 애드워즈 애플리케이션이 오류를 일으킨 것 같습니다. 내가 틀렸다면 나를 바로 잡으세요. 감사 – lifeline

답변

0

@lifeline, $user->GetService (GetCampaings.php) 메서드를 호출하면 오류가 발생합니다. 당신은 관련 캠페인을 얻을 수있는 샘플 코드를 사용하여 다음 행에서 예외 처리하는 경우 : GetService 방법에 따라 다른 예외를 많이 던질 수 있기 때문에,

try{ 
    $result_camp = GetCampaignsExample($user); 
} 
catch(Exception $e) { 
    // display your error message 
} 

난 당신이 AdWords API documentation을 읽고 추천을 서비스 유형 (CampaignService을 사용 중입니다). 애드워즈 API의 오류 처리에 대해 자세히 알아보고 향후 두통을 줄이십시오. :)

또한 인증을위한 ClientLogin 메서드는 공식적으로 사용되지 않습니다. 자세한 내용은 here을 참조하십시오.

관련 문제