public function validate()
{
if (
(!is_null($this->jsonKeyFilePath) || !is_null($this->scopes))
&& (!is_null($this->clientId) || !is_null($this->clientSecret)
|| !is_null($this->refreshToken))
) {
throw new InvalidArgumentException(
'Cannot have both service account '
. 'flow and installed/web application flow credential values set.'
);
}
if (!is_null($this->jsonKeyFilePath) || !is_null($this->scopes)) {
if (is_null($this->jsonKeyFilePath) || is_null($this->scopes)) {
throw new InvalidArgumentException(
"Both 'jsonKeyFilePath' and "
. "'scopes' must be set when using service account flow."
);
}
} elseif (
is_null($this->clientId)
|| is_null($this->clientSecret)
|| is_null($this->refreshToken)
) {
throw new UnexpectedValueException(
"All of 'clientId', 'clientSecret', and 'refreshToken' must be set when 
using "
. "installed/web application flow."
);
}
}
based on the code above the service account oauth2 flow doesn't seem to 
work because it tries to always check for the presence of clientId etc

On Thursday, September 7, 2023 at 3:32:41 PM UTC+5:30 Nayana Hettiarachchi 
wrote:

> Hi,
>
> i have my google_ads_php.ini file look as follows
>
> jsonKeyFilePath = 
> "/home/nayana/code/keywordapp-backend/managed-client-portal-4176c1bf1e30.json"
> scopes = "https://www.googleapis.com/auth/adwords";
> impersonatedEmail = "[email protected]"
>
> and when I use 
> oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();
>
> i get the following error 
>
> HP Fatal error:  Uncaught UnexpectedValueException: All of 'clientId', 
> 'clientSecret', and 'refreshToken' must be set when using installed/web 
> application flow. in 
> /home/nayana/code/google-ads-php/src/Google/Ads/GoogleAds/Lib/OAuth2TokenBuilder.php:216
>  
>
> i followed instruction on service account flow. anyone have experience on 
> this?
>
> Nayana
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e14c1ae0-af85-4e6c-a338-d95955940229n%40googlegroups.com.

Reply via email to