Ruby on Rails
Monday, January 12, 2015
Have someone worked with Google AdWords API ?
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 ... end endand following the example of 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 endbut 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
How can I fix this?
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/84be4dcf-b5bd-4470-8922-e282ab37570f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment