我正在使用以下gem adwords-api-ruby,我已完成以下操作:
require 'adwords_api'
class Client
def initialize
@adwords = AdwordsApi::Api.new({
:authentication => {
:method => 'OAuth2',
:oauth2_client_id => 'xxxxx',
:oauth2_client_secret => 'xxxxx',
:developer_token => 'xxxx',
:client_customer_id => '5xxxx',
:user_agent => 'Ruby Sample'
},
:service => {
:environment => 'Production'
}
})
end
def get_service(name, version)
return @adwords.service(name, version)
end
end
client = Client.new
campaign_srv = client.get_service(:CampaignService, nil)
campaigns = campaign_srv.get({:fields => ['Id', 'Name', 'Status']})
但我得到了:
`generate_access_token': AdsCommon::Errors::OAuth2VerificationRequired (AdsCommon::Errors::OAuth2VerificationRequired)
我猜是因为我没有访问令牌。我想知道如何获得该访问令牌?假设我想访问多个API(来自我的客户端),并且我希望将该访问令牌存储在我的数据库中。我有什么方法可以这样做吗?