Google api 为googleadsapi实现服务器到服务器的通信

Google api 为googleadsapi实现服务器到服务器的通信,google-api,google-ads-api,adsense,Google Api,Google Ads Api,Adsense,我正在尝试使用服务帐户运行此Google Ads API Java示例: Java代码: AdWordsSession session; try { // Generate a refreshable OAuth2 credential. Credential oAuth2Credential = new OfflineCredentials.Builder() .forApi

我正在尝试使用服务帐户运行此Google Ads API Java示例:

Java代码:

AdWordsSession session;
        try {
            // Generate a refreshable OAuth2 credential.
            Credential oAuth2Credential = new OfflineCredentials.Builder()
                            .forApi(Api.ADWORDS)
                            .fromFile()
                            .build()
                            .generateCredential();

            // Construct an AdWordsSession.
            session =
                    new AdWordsSession.Builder().fromFile().withOAuth2Credential(oAuth2Credential).build();
        } catch (ConfigurationLoadException cle) {
            System.err.printf(
                    "Failed to load configuration from the %s file. Exception: %s%n",
                    DEFAULT_CONFIGURATION_FILENAME, cle);
            return;
        } catch (ValidationException ve) {
            System.err.printf(
                    "Invalid configuration in the %s file. Exception: %s%n",
                    DEFAULT_CONFIGURATION_FILENAME, ve);
            return;
        } catch (OAuthException oe) {
            System.err.printf(
                    "Failed to create OAuth credentials. Check OAuth settings in the %s file. "
                            + "Exception: %s%n",
                    DEFAULT_CONFIGURATION_FILENAME, oe);
            return;
        }

        AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance(); 
我添加了包含以下内容的
ads.properties
文件:

# Path to the service account secrets file in JSON format.
# Provided by https://console.developers.google.com.
api.googleads.serviceAccountSecretsPath=/test-xxxxxx-xxxxxxxx.json

# Email address of the user to impersonate.
# This should be a user who has access to your Google Ads account and is in the same
# Google Apps Domain as the service account.
api.googleads.serviceAccountUser=xxxxxxxxxxxxxxx

# Token which provides access to the Google Ads API in general. It does not
# grant access to any particular ad account (OAuth is used for this purpose).
api.googleads.developerToken=xxxxxxxxxxxxxxxxxxxxxxx

# Required for manager accounts only: Specify the login customer ID used to
# authenticate API calls. This will be the customer ID of the authenticated
# manager account. You can also specify this later in code if your application
# uses multiple manager account + OAuth pairs.
#
# api.googleads.loginCustomerId=INSERT_LOGIN_CUSTOMER_ID_HERE
资料来源:

但是当我运行代码时,我得到一个错误:

Invalid configuration in the ads.properties file. Exception: Client ID must be set as api.adwords.clientId in ads.properties.
If you do not have a client ID or secret, please create one in the API console: https://console.developers.google.com/project caused by: [clientId]
你知道我怎样才能正确运行这段代码吗