Hello Anash,
Yes, I am also looking for that.
How i can define Authinfo for any report download.
$oauthInfo = array('oauth_consumer_key' => 'consumer_key',
'oauth_consumer_secret' => 'consumer secret', 'oauth_token' => token,
'oauth_token_secret' => token_secret);
$user = new AdWordsUser(OAUTH_PATH, NULL, NULL, NULL, NULL, NULL, NULL,
OAUTH_SETTINGS_PATH, NULL, $oauthInfo);
In Above Example how to define $oauthInfo for oAuth 2.0 use? and which
parameter i need to pass?
Thanks,
Chirag
On Thursday, November 15, 2012 5:39:45 AM UTC+5:30, Dale Olson wrote:
>
> I am intensely interested in this thread, and it seems to be drifting away
> from the original question - how to run an adwords adhoc report without
> user input to authenticate/authorize using OAuth2. Win Ko Aye responded
> with a very helpful and detailed set of steps to create a service account
> and create the request, which I followed to the letter but I am still
> struggling to get working.
> For the service account approach, I get all the way through creating the
> token and try to call the service and get back :
> *com.google.api.ads.common.lib.exception.OAuthException: OAuth2 token
> could not be refreshed.*
> *...*
> *Caused by: com.google.api.client.auth.oauth2.TokenResponseException: 400
> Bad Request
> {
> "error" : "invalid_grant"
> }*
> When looking into what might cause this there are conflicting reports on
> whether you can even use a service account with the adwords API and the
> error seems to be saying that I am authenticated but not authorized to use
> the service. Any ideas here?
> Anash, regarding your suggestion to create an installed app account this
> does not seem to satisfy the original request for a way to set up
> application to application access with no user input required. Please let
> me know if i misunderstood something here.
>
> On Tuesday, November 13, 2012 6:50:39 PM UTC-8, Anash P. Oommen wrote:
>>
>> Hi Paul,
>>
>> The AdWords API PHP library already has a code example that shows how to
>> use OAuth2 with AdWords API. You can find it here:
>> http://code.google.com/p/google-api-adwords-php/source/browse/trunk/examples/v201209/Misc/UseOAuth2.php.
>>
>> Also, service accounts allow you to call AdWords API without any user
>> interaction, but that is not the only way to achieve server-to-server call.
>> If you care only about offline call without user interaction and not about
>> impersonating users, then you can use regular OAuth2 call with offline =
>> true as explained here:
>> https://developers.google.com/accounts/docs/OAuth2WebServer#offline. To
>> summarize,
>>
>> 1. You need to get an OAuth2 clientId and secret from
>> https://code.google.com/apis/console. When creating the token, select
>> "Installed Application" and select "Other" in the "Installed Application
>> type".
>> 2. Substitute these values in UseOAuth2.php example and run it. This code
>> example will generate an access token and refresh token. The access token
>> will expire after an hour, refresh token doesn't.
>> 3. When your access token expires, refresh it using
>> $user->RefreshOAuth2AccessToken call.
>>
>> You could generate a refresh token for your parent MCC once and continue
>> using it without requiring user interaction.
>>
>> Cheers,
>> Anash P. Oommen,
>> AdWords API Advisor.
>>
>> On Tuesday, 13 November 2012 12:59:43 UTC-8, Pianoman wrote:
>>>
>>> Dear Google Adwords API Team,
>>>
>>> As you are recommending we start authenticating using OAuth 2.0, could
>>> you (Eric Koleda for example) please either organise a hangout and/or
>>> create a screencast, explaining how to go about OAuth 2.0 authentication
>>> using the PHP Client Library?
>>>
>>> The only PHP Client Library screencast help I can see online is
>>> here<http://youtube.googleapis.com/v/Idvia4600_E>,
>>> but that's pretty dated now.
>>>
>>> I am unfamiliar with OAuth 2.0.
>>> For now I am sticking to the deprecated authentication system, but would
>>> like to migrate to OAuth 2.0.
>>>
>>> Regards,
>>> --
>>> Paul
>>>
>>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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