Hi,

That error indicates that the *Authorization* header in your request is 
malformed. Please log your SOAP requests and check that header to make sure 
it is formatted as specified here 
<https://developers.google.com/adwords/api/docs/guides/authentication#http_request_header>
.

You might want to check out the Ruby library's 
create_ad_words_session_without_properties_file.rb 
<https://github.com/googleads/google-api-ads-ruby/blob/master/adwords_api/examples/v201409/misc/create_ad_words_session_without_properties_file.rb>
 example 
as well, since that shows how to create a session manually.

Cheers,
Josh, AdWords API Team

On Monday, January 12, 2015 at 8:19:26 AM UTC-5, Alessandro Dias wrote:
>
> I'm using
>
>    - devise
>    - omniauth
>    - omniauth-google-oauth2
>    - google-adwords-api
>
> I'm getting the token from oauth callback:
>
> class OmniauthCallbacksController < Devise::OmniauthCallbacksController
>   def google_oauth2
>     session[:token] = request.env["omniauth.auth"].credentials
>     ...
>   endend
>
> and following the example of adwords on rails 
> <https://github.com/googleads/google-api-ads-ruby/tree/master/adwords_api/examples/adwords_on_rails>
>  to 
> get api instance:
>
>  def adwords_api
>    @api ||= create_adwords_api
>  end
>
>  def create_adwords_api
>    api = AdwordsApi::Api.new Rails.application.config_for(:adwords)
>
>    token = session[:token]
>    if token
>      credentials = api.credential_handler
>      credentials.set_credential :oauth2_token, token
>      credentials.set_credential :client_customer_id, current_user.id
>    end
>    api
>  end
>
> but when I try to get campaigns, It returns an error: 
> [AuthenticationError.OAUTH_TOKEN_HEADER_INVALID 
> @ ; trigger:'<null>'
>
> and based on the log, this is the url of request:
> [2015-01-09T10:12:44.237172 #6481] DEBUG -- : SOAP request: 
> https://adwords.google.com/api/adwords/cm/v201409/CampaignService
>
> why this error happens and how can I fix?
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/220b79b4-e94d-42c0-8ef7-96521d352b23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to