Configuring the adsapi_php.ini file / Error type : All of 'clientId', 'clientSecret', and 'refreshToken' must be set when using installed/web application flow.

635 views
Skip to first unread message

SnowYou

unread,
Jun 8, 2018, 9:54:20 AM6/8/18
to AdWords API and Google Ads API Forum
Hi,

I'm trying to use the adWords API in a web application, but it seems that my authentification file is incorrect.
Here it is :

[ADWORDS]
; Required AdWords API properties. Details can be found at:
developerToken = "" ;Nothing here because I'm using a test account ?
clientCustomerId = "XXX-XXX-XXXX"

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

; Optional additional AdWords API settings.
; 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:

; For installed application or web application flow.
clientSecret = "M6XXXXXXXXXXXXXXXXXXXDr"
refresh_token = "1/FzXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXv4y8yZhAP"

; For service account flow.
; jsonKeyFilePath = "INSERT_ABSOLUTE_PATH_TO_OAUTH2_JSON_KEY_FILE_HERE"
; impersonatedEmail = "INSERT_EMAIL_OF_ACCOUNT_TO_IMPERSONATE_HERE"

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

[CONNECTION]
; Optional proxy settings to be used by requests.
; If you don't have username and password, just specify host and port.
; proxy = "protocol://user:pass@host:port"
; Enable transparent HTTP gzip compression for all reporting requests.
; enableReportingGzip = false

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

Is something wrong ? Or is this error coming from something else ?

Bharani Cherukuri (AdWords API Team)

unread,
Jun 8, 2018, 4:59:06 PM6/8/18
to AdWords API and Google Ads API Forum
Hello, 

Can you make sure that you have specified the path to the root directory which has your OAuth credentials? You can check this guide for more information. Please note that Developer token is only available for Production accounts. The builder's fromFile() method looks for an adsapi_php.ini file in your home directory by default. If you want to store this file in another directory, pass the path of the file as an argument. Can you give this a try and let me know if you still have any issues? 

Regards,
Bharani, AdWords API Team

Peter Bowen

unread,
Jun 11, 2018, 4:25:20 AM6/11/18
to AdWords API and Google Ads API Forum
Unless I'm mistaken you have to have a developer token, even if you're using test accounts.

Bharani Cherukuri (AdWords API Team)

unread,
Jun 11, 2018, 10:54:33 AM6/11/18
to AdWords API and Google Ads API Forum
Hello Peter, 

That's right. You will have to set the developer token, clientId, client Secret and refreshToken in the adsapi.ini file. Please note that while making API calls against test accounts, the developer token can have a Test account access. You will also need to make sure that the root path specified in the fromFile() points to the adsapi.ini file. Can you give this a try and let me know if you run into any issues?

Thanks,
Bharani, AdWords API Team
Reply all
Reply to author
Forward
0 new messages