I am using the google-api-ads-ruby and oauth 2.0 to have users authenticate
and then make calls on their behalf to pull reports about their AdWords
account.
I have Oauth 2.0 fully set up for Google Analytics and it works.
Next I added Google AdWords to the scope.
I redirect the user to get approval.
When they return I take the verification code in the parameter on the
callback and store it in my database.
That all works great.
But, here is where I am falling flat:
When I try to create a call on the user's behalf I get:
AdsCommon::Errors::AuthError: Authorization error occured: Authorization
failed. Server message:
{
"error" : "redirect_uri_mismatch"
}
Here is my code for the method I am using to call the API:
config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')
adwords = AdwordsApi::Api.new(config_filename)
api_version = :v201306
token = adwords.authorize({:oauth2_verification_code =>
google_authentication.verification_code})
campaign_srv = adwords.service(:CampaignService, api_version)
It is failing on the adwords.authorize line.
My local redirect uri in the api console is:
http://127.0.0.1:3000/users/auth/google_oauth2/callback
This redirect uri works for authorizing the user using omniauth the first
go around, but not when I am using the google-api-ads-ruby gem to make
calls to the API.
Any ideas on how I can go about fixing this?
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
---
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].
For more options, visit https://groups.google.com/groups/opt_out.