Google AdWords API autorization raising AdsCommon::Errors::AuthError

1,047 views
Skip to first unread message

Alessandro Dias

unread,
Jan 6, 2015, 2:23:54 PM1/6/15
to adwor...@googlegroups.com
AdsCommon::Errors::AuthError Authorization error occured: Authorization failed. 
Server message: 
{"error" : "invalid_grant", "error_description" : "Code was already redeemed."}

this is the part of autorization

def google_oauth2_callback
  api = AdwordsApi::Api.new(Rails.application.config_for(:adwords_api))
  session[:token] = api.authorize \
    oauth2_callback: user_omniauth_callback_url(:google_oauth2),
    oauth2_verification_code: params[:code]

I'm using: Rails + devise + omniauth-google-oauth2

And also I added the adwords scope

Josh Radcliff (AdWords API Team)

unread,
Jan 7, 2015, 10:18:48 AM1/7/15
to adwor...@googlegroups.com
Hi,

The Code was already redeemed error means that you are trying to use an authorization code that has already been used. A given authorization code can only be used once. Please make sure you are using the authorization code passed in the request to the oauth2_callback when you submit the OAuth request to get the refresh token.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages