1
我一直在运行这个可怕的OAuth验证失败,它似乎不想给我一个身份验证令牌......?Ruby谷歌Adwords Api OAuth验证失败
这里是我的app.rb:
require 'adwords_api'
require 'adwords_api/utils'
adwords = AdwordsApi::Api.new
campaign_srv = adwords.service(:CampaignService, :v201109)
campaign_srv.get
这里是我的adwords_api.yml:
:authentication:
:method: OAuth
:oauth_consumer_key: anonymous
:oauth_consumer_secret: anonymous
:developer_token: [email protected]++USD
:user_agent: Ruby Testing
:service:
:environment: SANDBOX
:connection:
:enable_gzip: false
:library:
:log_level: INFO
我每次运行应用程序,我得到这个错误:
/Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/auth/oauth_handler.rb:271:in `raise_oauth_verification_error': AdsCommon::Errors::OAuthVerificationRequired (AdsCommon::Errors::OAuthVerificationRequired)
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/auth/oauth_handler.rb:237:in `generate_access_token'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/auth/oauth_handler.rb:181:in `create_token'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/auth/base_handler.rb:62:in `get_token'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/auth/oauth_handler.rb:92:in `headers'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_headers/oauth_header_handler.rb:59:in `generate_headers'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_headers/oauth_header_handler.rb:42:in `prepare_request'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_service.rb:106:in `block in set_headers'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_service.rb:105:in `each'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_service.rb:105:in `set_headers'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_service.rb:98:in `block in execute_soap_request'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/savon-0.9.9/lib/savon/client.rb:153:in `yield_objects'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/savon-0.9.9/lib/savon/client.rb:147:in `process'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/savon-0.9.9/lib/savon/client.rb:76:in `request'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_service.rb:97:in `execute_soap_request'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-ads-common-0.6.3/lib/ads_common/savon_service.rb:80:in `execute_action'
from /Users/Qubit/.rvm/gems/ruby-1.9.2-p290/gems/google-adwords-api-0.5.2/lib/adwords_api/v201109/campaign_service.rb:19:in `get'
from app.rb:12:in `<main>'
到底是怎么回事?这是不是足够的adwords沙箱api?
谢谢。
非常感谢上述代码。该文档声明运行get_campaigns.rb示例(google-api-ads-ruby/adwords_api/examples/v201206/basic_operations),但是他们没有告诉您的是您应该选择一个像上面所述的配置。一旦运行了get_campaign示例,就可以运行它们的adwords_on_rails示例(这将需要记录的OAuth2配置)。多么糟糕,没有组织的混乱。没有让Google印象深刻。 – aantix 2012-10-06 06:00:54