Hello Georgi,
>From the stack trace I can see OAUTH2 method is used. You should use
OAUTH2_JWT instead. Please check this line in the configuration:
:authentication => {
:method: OAUTH2_JWT
...
Not related to the issue below, but require for the next step. Please make
sure you are signed up for a domain and have domain administration rights.
This is a pre-requisite for using JWT authorization.
-Danial, AdWords API Team.
On Wednesday, January 16, 2013 4:15:54 PM UTC+4, [email protected] wrote:
>
> Hi Danial,
>
> Thanks for the quick reply, we've replaced the adwords initialization with
> the one you've suggested and we are having a progress, but still there is
> another error:
>
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/auth/oauth2_handler.rb:116:in
>
> `validate_credentials': Client id is not included in the credentials.
> (AdsCommon::Errors::AuthError)
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/auth/oauth2_handler.rb:148:in
>
> `create_token'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/auth/base_handler.rb:50:in
>
> `get_token'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/auth/oauth2_handler.rb:82:in
>
> `get_token'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/auth/oauth2_handler.rb:75:in
>
> `auth_string'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/savon_headers/oauth_header_handler.rb:45:in
>
> `generate_headers'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/savon_headers/base_header_handler.rb:75:in
>
> `prepare_request'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/savon_service.rb:103:in
>
> `block in execute_soap_request'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/savon-1.2.0/lib/savon/client.rb:129:in
> `yield_objects'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/savon-1.2.0/lib/savon/client.rb:122:in
> `process'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/savon-1.2.0/lib/savon/client.rb:84:in
> `block in request'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/savon-1.2.0/lib/savon/soap/request_builder.rb:56:in
>
> `call'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/savon-1.2.0/lib/savon/soap/request_builder.rb:56:in
>
> `request'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/savon-1.2.0/lib/savon/client.rb:86:in
> `request'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/savon_service.rb:101:in
>
> `execute_soap_request'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/savon_service.rb:81:in
>
> `execute_action'
> from
> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-adwords-api-0.8.0/lib/adwords_api/v201209/campaign_service.rb:21:in
>
> `get'
>
> The application now requires client id. We've tried to add
> :oauth2_client_id and the :oauth2_client_secret (didn't work either), but
> i'm not sure if this is the right direction.
>
> Let me know if you need further information,
>
> All the best,
> Georgi
>
> On Tuesday, January 15, 2013 2:04:53 PM UTC+2, Danial Klimkin wrote:
>>
>> Hello Georgi,
>>
>>
>> If you initialize the library with a hash, you need to make sure to
>> provide all required credentials. Make sure to include all required fields
>> like this:
>>
>> adwords = AdwordsApi::Api.new({
>> :service => {
>> :environment => :PRODUCTION
>> },
>> :library => {
>> :log_level => "DEBUG"
>> },
>> :authentication => {
>> :method: OAUTH2_JWT
>> :oauth2_issuer: '[email protected]'
>> :oauth2_secret: 'key_secret'
>> :oauth2_keyfile: '/path/to/key.p12'
>> :developer_token: '<dev_token>',
>> :client_customer_id: '123-456-7890'
>> }
>> })
>>
>>
>> -Danial, AdWords API Team.
>>
>> On Monday, January 14, 2013 4:05:36 PM UTC+4, [email protected] wrote:
>>>
>>> Hello everyone,
>>>
>>> We’ve recently started to use adwords api and now we are trying to
>>> automate few tasks. We’re using OAuth2 authentication and ruby.
>>>
>>> We’ve followed the example here
>>> https://code.google.com/p/google-api-ads-ruby/source/browse/adwords_api/examples/v201209/misc/use_oauth2_jwt.rb<https://code.google.com/p/google-api-ads-ruby/source/browse/adwords_api/examples/v201209/misc/use_oauth2.rb>to
>>> authenticate, the only difference is how we initialize the adwords api:
>>>
>>> adwords = AdwordsApi::Api.new({
>>>
>>> :library => {
>>>
>>> :log_level => "DEBUG"
>>>
>>> }})
>>>
>>> # option 1 and option 2 not modified from the example
>>>
>>> campaign_srv = adwords.service(:CampaignService, API_VERSION)
>>>
>>>
>>> We’ve downloaded the private key file and the path is set correctly and
>>> we’ve tried both options. This is the error we get:
>>>
>>> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/credential_handler.rb:65:in
>>>
>>> `set_credential': undefined method `[]=' for nil:NilClass (NoMethodError)
>>>
>>> from
>>> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/api.rb:103:in
>>>
>>> `block in authorize'
>>>
>>> from
>>> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/api.rb:102:in
>>>
>>> `each_pair'
>>>
>>> from
>>> /path/.rvm/gems/ruby-1.9.3-p327/gems/google-ads-common-0.9.0/lib/ads_common/api.rb:102:in
>>>
>>> `authorize'
>>>
>>>
>>> Let me know if you need further information, i would like to find out
>>> the possible reason for that error or if there is any error in our
>>> configuration or code?
>>>
>>>
>>>
>>> Thank you in advance for your time,
>>>
>>> Georgi
>>>
>>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en