Google Groups

Ruby and OAuth


Thomas May 30, 2012 2:41 AM
Posted in group: AdWords API Forum
Hello,

I'm trying to work out how to use OAuth with the Google Adwords API. Sofar I didn't have much luck. While using ClientLogin is working perfect, OAuth will always throw "AuthenticationError.OAUTH_TOKEN_INVALID".

I tried my best to stay as close to the Ruby-Example in v201109_01 as possible, but still no luck.

What works:

1) Making a request against the API with OAuth returns an AdsCommon::Errors::OAuthVerificationRequired Error.
2) Using the provided URL to redirect the user to the authentication page (why not provide the redirection URL in the ruby example?)

Now it stops working: I set the verification code like so (like in the example): credential_handler.set_credential(:oauth_verification_code, options[:oauth_verification_code]).
Now doing a new request results in AuthenticationError.OAUTH_TOKEN_INVALID.

I honestly couldn't get it to work. My questions:

1) Could it have something todo with the account I'm using to allow access to Adwords? I'm using an MCC-Account with administration rights.
2) Why is the ruby implementation so different from phyton or php? (UpgradeAuthToken?)

I'm really at a loss here.

Best regards
  Thomas