'All of 'clientId', 'clientSecret', and 'refreshToken' must be set when using installed/web application flow.'

1,634 views
Skip to first unread message

ma...@wecode.dk

unread,
Aug 24, 2017, 10:31:56 PM8/24/17
to AdWords API Forum
Hi Google API-team, 

I have made use of an earlier version of your API with great success, but the version ran out, so I was force to update my googleads-php-lib. 

When i try to run one of the examples-file, GetCampaigns.php, I get the following error:

"PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'All of 'clientId', 'clientSecret', and 'refreshToken' must be set when using installed/web application flow.' in C:\Users\myname\OneD
rive\Sites\Scraper\googleads-php-lib\src\Google\AdsApi\Common\OAuth2TokenBuilder.php:204"

But I have filled out my clientId, clientSecret and generated a new refreshToken in the adsapi_php.ini-file. Maybe the path is wrong since it cannot find the credentials. The file is placed in C:\Users\myname\OneD
rive\Sites\Scraper\adsapi_php.ini so that fromFile() can access it.

Can you please help me out? Do you need further information?

Here is my adsapi_php.ini: 

[ADWORDS]
; Required AdWords API properties. Details can be found at:
; https://developers.google.com/adwords/api/docs/guides/basic-concepts#soap_and_xml
developerToken = "-fbfPkrq......qv9Tg"
clientCustomerId = "...-385-1.9...."

; Optional. Set a friendly application name identifier.
userAgent = "Scraper"

; Optional additional AdWords API settings.
; endpoint = "https://adwords.google.com/"
; isPartialFailure = false

; Optional setting for utility usage tracking in the user agent in requests.
; Defaults to true.
; includeUtilitiesInUserAgent = true

[ADWORDS_REPORTING]
; Optional reporting settings.
; isSkipReportHeader = false
; isSkipColumnHeader = false
; isSkipReportSummary = false
; isUseRawEnumValues = false

[OAUTH2]
; Required OAuth2 credentials. Uncomment and fill in the values for the
; appropriate flow based on your use case. See the README for guidance:
; https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started

; For installed application or web application flow.
client_id = "1198631.....googleusercontent.com"
client_secret = "XuQ...._zSp"
refresh_token = "1/E1VN2......0Ap6L00nXQWw"

; For service account flow.
; jsonKeyFilePath = "INSERT_ABSOLUTE_PATH_TO_OAUTH2_JSON_KEY_FILE_HERE"
; scopes = "https://www.googleapis.com/auth/adwords"
; impersonatedEmail = "INSERT_EMAIL_OF_ACCOUNT_TO_IMPERSONATE_HERE"

[SOAP]
; Optional SOAP settings. See SoapSettingsBuilder.php for more information.
; compressionLevel = <COMPRESSION_LEVEL>
; wsdlCache = <WSDL_CACHE>

[PROXY]
; Optional proxy settings to be used by SOAP requests.
; host = "<HOST>"
; port = <PORT>
; user = "<USER>"
; password = "<PASSWORD>"

[LOGGING]
; Optional logging settings.
; soapLogFilePath = "/soap.log"
; soapLogLevel = "INFO"
; reportDownloaderLogFilePath = "path/to/your/report-downloader.log"
; reportDownloaderLogLevel = "INFO"
; batchJobsUtilLogFilePath = "path/to/your/bjutil.log"
; batchJobsUtilLogLevel = "INFO"

Peter Oliquino

unread,
Aug 24, 2017, 11:21:46 PM8/24/17
to AdWords API Forum
Hi,

You may refer to this guide if you are upgrading to a new version of the PHP client library and to this section as to where your adsapi_php.ini file should be stored. Additionally, since the issue you are encountering appears to be more specific to the PHP client library configuration, you may get in touch with the library owners via this link should you still encounter any issues with the setup. I hope this helps.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages