SullX
SullX

Reputation: 214

Ruby Google Adwords Api OAuth verification failure

I keep running in to this awful OAuth Verification Failure, it seems to not want to give me an authentication token...?

Here is my app.rb:

require 'adwords_api'
require 'adwords_api/utils'

adwords = AdwordsApi::Api.new
campaign_srv = adwords.service(:CampaignService, :v201109)
campaign_srv.get

Here is my 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

Every time I run the app I get this error:

/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>'

What is going on? Isn't this sufficient for the adwords sandbox api??

Thank you.

Upvotes: 1

Views: 732

Answers (1)

SullX
SullX

Reputation: 214

I am still unsure what the issue is with OAuth, but I found out how to use 'ClientLogin' in the sandbox and this worked just fine. All that was needed was to configure my adwords_api.yml to

:authentication:
 :method: ClientLogin
 :password: PASSWORD_GOES_HERE
 :email: EMAIL_GOES_HERE
 :developer_token: [email protected]++USD
 :user_agent: Ruby Testing
:service:
  :environment: SANDBOX
:connection:
  :enable_gzip: false
  :library:
  :log_level: INFO

Upvotes: 1

Related Questions