2016-03-25 14 views
1

したがって、何ヶ月も実行されていたBingAdsレポートプログラムは突然105(InvalidCredentials)エラーに悩まされています。アクセストークンが期限切れになったので、私は新しいトークンを要求しました。これは成功すると、将来満了する新しいアクセストークンを私に与えます。Bing Ads API - 無効な資格情報エラー

$accessTokenExchangeUrl = "https://login.live.com/oauth20_token.srf"; 

    $accessTokenExchangeParams = array(); 
    $accessTokenExchangeParams['client_id']  = $this->client_id(); 
    $accessTokenExchangeParams['client_secret'] = $this->client_secret(); 
    $accessTokenExchangeParams['grant_type'] = 'refresh_token'; 
    $accessTokenExchangeParams['refresh_token'] = $code; 

    // Create an HTTP client and execute an HTTP POST request to 
    // exchange the authorization token for an access token and 
    // refresh token. 
    $httpClient = new HttpClient(); 
    $responseJson = $httpClient->postData($accessTokenExchangeUrl, $accessTokenExchangeParams); 

    // The response formatted in json 
    $responseArray = json_decode($responseJson, TRUE); 

    // If the response contains an access_token element, it was successful. 
    // If not, an error occurred - throw an exception 
    if (isset($responseArray['access_token'])) 
    { 
     return $responseArray; 

    } 

しかし、その後、105エラーでその新しいトークンの結果使用した:

$proxy = \BingAds\Proxy\ClientProxy::ConstructWithCredentials($wsdl, $bingUserName, 
                    $bingPasswd, 
                    $developer_token, 
                    $access_token); 

$report = new KeywordPerformanceReportRequest(); 
$report->Format = ReportFormat::Tsv; 
$report->ReportName = 'Keyword Performance Report'; 
$report->ReturnOnlyCompleteData = false; 

    <report definition> 

$encodedReport = new SoapVar($report, SOAP_ENC_OBJECT, 'KeywordPerformanceReportRequest', $proxy->GetNamespace()); 

$this->bingReportRequestID = $this->_BingSubmitGenerateReport($proxy, $encodedReport); 
$request = new SubmitGenerateReportRequest(); 
$request->ReportRequest = $report; 

$retval = $proxy->GetService()->SubmitGenerateReport($request)->ReportRequestId; 
    ::> throws a SoapFault 

任意のアイデア?私が言ったように、それは数ヶ月間うまくいきました、今、突然、何もありません。

答えて

0

明らかに、認証にrefresh_tokenを使用しています。取得した新しいトークンを使用して、新しいrefresh_tokenを生成し、代わりにそのトークンを使用する必要があります。

関連する問題