Hi Ian,

A refresh token obtained for *offline* access (such as the one generated by 
the example) won't expire unless you revoke it, so you can continue to use 
it to fetch new access tokens. Access tokens *do* expire 
<https://developers.google.com/adwords/api/docs/guides/authentication#access_and_refresh_token>,
 
but the client library will take care of fetching new ones as needed.

In terms of the validity of your credentials, if you are able to run the 
examples without errors then your credentials are probably fine. Once you 
have at least one campaign in your account, if you can run the 
get_campaigns.pl 
<https://github.com/googleads/googleads-perl-lib/blob/master/examples/v201406/basic_operations/get_campaigns.pl>
 example 
and get the campaigns back, then that's an indication that your credentials 
are working.

Cheers,
Josh, AdWords API Team

On Sunday, August 17, 2014 8:57:56 AM UTC-4, Ian wrote:
>
> Thanks Josh, thats useful and getting somewhere now.
>
> I've followed the process and received a token and access token (with the 
> perl api), receiving a url and then getting a token on a webpage manually 
> pasting the url in.
>
> I've added the refresh token to adwords.properties and I think its all 
> working, at least I don't get any errors now...
>
> Just wondering, how long does the refresh token last for typically, does 
> it expire every so often? Its fine if it will last for a long while, I'm 
> happy to get the token manually, otherwise should I write something to 
> automate going to that page, receiving the token and updating 
> adwords.properties or something by the server? (I'm assuming not as that 
> doesn't feel right).
>
> Can I be sure that oauth2 is working now that I don't get any errors, and 
> am good to go ? (are running the misc scripts without error now fairly 
> conclusive oauth2 is now working, or is there something specific that will 
> prove it ?)
>
> Thanks,
>
> Ian
>
>
>
> On Friday, 15 August 2014 20:43:10 UTC+1, Josh Radcliff (AdWords API Team) 
> wrote:
>>
>> Hi Ian,
>>
>> Service accounts are quite complex -- as mentioned in our OAuth2.0 
>> Service Accounts guide 
>> <https://developers.google.com/adwords/api/docs/guides/service-accounts#alt>
>> :
>>
>>> Many developers look at service accounts because they are interested in 
>>> programmatic access to an API using OAuth2.0, but without user 
>>> intervention. However, due to the complicated nature of setting up service 
>>> accounts for the AdWords API, a simpler alternative that achieves the same 
>>> goal is to use the OAuth 2.0 installed application flow and persist the 
>>> refresh token. This way, your application will always be able to request a 
>>> new access token when necessary.
>>
>>
>> I would definitely recommend trying the *installed application* flow 
>> first - it works for 99% of the developers I speak to who initially think 
>> they need a service account.
>>
>> As far as getting the refresh token for the *installed application* flow 
>> goes, please check out our OAuth2 wiki 
>> <https://github.com/googleads/googleads-perl-lib/wiki/Using-OAuth-2.0> 
>> on github. It'll walk you through the process, step by step.
>>
>> For you use case, by "Master Account" I'm guessing you mean an MCC (My 
>> Client Center) account. If all of your AdWords accounts are linked to your 
>> MCC, similar to the layout described in this guide 
>> <https://developers.google.com/adwords/api/docs/guides/clientlogin-to-oauth2-single-mcc>,
>>  
>> then you can just obtain a single refresh token while logged in as the MCC, 
>> and then set the *clientCustomerId* on each request in one of two ways:
>>
>> 1. Set the *client *in your adwords.properties file (this probably won't 
>> be ideal for your use case because you have multiple AdWords accounts).
>> 2. Call set_client_id(xxxx) on your Client 
>> <https://github.com/googleads/googleads-perl-lib/blob/master/lib/Google/Ads/AdWords/Client.pm>
>>  object 
>> between API calls.
>>
>> Cheers,
>> Josh, AdWords API Team
>>
>> On Friday, August 15, 2014 2:47:59 PM UTC-4, Ian wrote:
>>>
>>> Hi all,
>>>
>>> I've inherited a some code that recently used ClientLogin and needs to 
>>> work with Oauth2. I've been rummaging through the documentation, like at 
>>> https://github.com/googleads/googleads-perl-lib/wiki/Using-OAuth-2.0 and 
>>> using Perl client 2.17 but struggling to understand what I need to set up. 
>>> Firstly its to be used for a server to automate communication with adwords 
>>> to check various campaigns etc, so I'm assuming Service Account is what 
>>> seems applicable.
>>>
>>> I'm looking at adwords.properties, and have set up a project at 
>>> console.developers.google.com (I've also generated a P12 key, converted 
>>> and uploaded)
>>>
>>> I'm a bit confused about several parts. Service Accounts in the 
>>> documentation seems to imply it needs a oAuth2ClientSecret, however in the 
>>> console login it only seems to provide Client Id, Email-Address, 
>>> Fingerprints when I select that. So first question is, is a clientSecret 
>>> needed for service accounts (and if so, why isn't it displayed, or where do 
>>> I get it)? 
>>>
>>> In Adwords, we have a Master Account with one client id, and then also a 
>>> client id per domain account. Should I be setting clientId in 
>>> adwords.properties with the master account clientId, or domain account 
>>> clientId ?
>>>
>>> Currently in adwords.properties I have...
>>>
>>> clientId=xxx-xxx-xxxx (master clientId but have tried domain clientId, 
>>> not sure which is correct)
>>>
>>> oAuth2ClientId=10......apps.googleusercontent.com
>>> oAuth2ServiceAccountEmailAddress=
>>> 10........@developer.gserviceaccount.com
>>> oAuth2ServiceAccountDelegateEmail=em...@mydomain.com  (tried master 
>>> email and domain email)
>>> oAuth2ServiceAccountPEMFile=/fullpathwheremypemfileis.pem
>>>
>>> When I try and run anything it displays ""error_description" : "Invalid 
>>> impersonation prn email address.". Does it need something from 
>>> http://www.google.com/enterprise/apps/business/ for example ?
>>>
>>>
>>> Apologies for the long mail, wondering if anyone can help me understand 
>>> how to get this working, as I'm not finding the process clear. (any 
>>> examples would be greatly appreciated).
>>>
>>> Many thanks,
>>>
>>> Ian
>>>
>>>
>>>
>>>
>>>
>>>
>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to