Solved it, developer key was incorrectly typed in On Monday, March 18, 2024 at 3:27:31 PM UTC-7 Chris Lin wrote:
> I just cloned this app > https://github.com/googleads/google-ads-php/tree/main/examples/LaravelSampleApp > > and set it up and get the same error. Is it possible it's my > google_ads_php.ini? I left the contents of it below with the credentials > masked out, one of the requestIds was "e87P3kSbIgA-m-oFOB325Q" > > [GOOGLE_ADS] > developerToken = "XXXXXXXXXXX" > loginCustomerId = "XXXXXXXXXXX" > > [OAUTH2] > ; For service account flow. > jsonKeyFilePath = "VALID PATH TO JSON" > scopes = "https://www.googleapis.com/auth/adwords" > impersonatedEmail = "x...@xxx.xxx" > > On Monday, March 18, 2024 at 2:11:26 AM UTC-7 Chris Lin wrote: > >> Been trying to make a simple campaign reports using PHP/Laravel, tried to >> follow docs and search on Google but running into a wall. Is there a way to >> find out what the actual headers are being sent? I pieced together the code >> from the help docs and random google searches, feels like I am missing >> something basic? >> >> The error is below: >> -metadata: array:1 [ >> 0 => array:3 [ >> "@type" => " >> type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure" >> "errors" => array:1 [ >> 0 => array:2 [ >> "errorCode" => array:1 [ >> "authenticationError" => "OAUTH_TOKEN_HEADER_INVALID" >> ] >> "message" => "Oauth token HTTP header is malformed." >> ] >> ] >> "requestId" => "eZJRtqwznPOdfR-5M_9sgA" >> ] >> ] >> >> $oAuth2Credential = (new OAuth2TokenBuilder()) >> ->fromFile(storage_path('google_ads_php.ini')) >> ->build(); >> >> $googleAdsClient = (new GoogleAdsClientBuilder()) >> >> ->fromFile(storage_path('google_ads_php.ini')) >> ->withOAuth2Credential($oAuth2Credential) >> ->withDeveloperToken(env('GOOGLE_DEVELOPER_KEY')) >> ->withLoginCustomerId($this->managerCustomerId) >> ->build(); >> $query = 'SELECT campaign.id, campaign.name FROM campaign >> ORDER BY campaign.id'; >> $response = >> $googleAdsClient->getGoogleAdsServiceClient()->searchStream( >> SearchGoogleAdsStreamRequest::build($customerId, $query) >> ); >> > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "Google Ads API and AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/d7f9cc13-0357-4f3d-9989-819887c72ee8n%40googlegroups.com.