Oauth PHP谷歌广告词API获取活动
我正在使用GoogleAdWordsAPI连接adwords并列出所有的campaingns。我正在与OAuth连接到Adwords帐户,并成为一个access_令牌和一个refresh_令牌,我正在将其保存到DB中 现在我试着举个例子: 但是我的access_令牌和refresh_令牌在数据库中,所有API OAuth2凭据都在一个配置数组中Oauth PHP谷歌广告词API获取活动,oauth,google-api,google-ads-api,google-api-php-client,Oauth,Google Api,Google Ads Api,Google Api Php Client,我正在使用GoogleAdWordsAPI连接adwords并列出所有的campaingns。我正在与OAuth连接到Adwords帐户,并成为一个access_令牌和一个refresh_令牌,我正在将其保存到DB中 现在我试着举个例子: 但是我的access_令牌和refresh_令牌在数据库中,所有API OAuth2凭据都在一个配置数组中 如何使用此凭据查询google adwords服务?下面复制的示例第81行中提到的OAuth2TokenBuilder类有几个方法,可以让您设置参数,
如何使用此凭据查询google adwords服务?下面复制的示例第81行中提到的OAuth2TokenBuilder类有几个方法,可以让您设置参数,而不是从配置文件中读取参数
$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile()->build();
fromFile方法将从配置文件中读取参数。您的新代码可能如下所示:
$oAuth2Credential = (new OAuth2TokenBuilder())
->withClientId(your oauth2 client id here)
->withClientSecret(your oauth2 client secret here)
->withRefreshToken(your stored refresh token here)
->build();
Google AdWords API的其他一些问题的概述如下:
谢谢,这对我很有帮助!干杯,尼克:)