Hi Eric,

As a starting point, I'd recommend using our Ruby client library 
<https://github.com/googleads/google-api-ads-ruby> if you are not already 
doing so.

Your use case is a great fit for offline access 
<https://developers.google.com/adwords/api/docs/guides/authentication#offline_access>,
 
which will give you a *refresh token* when the user accepts the OAuth 
prompt. With this *refresh token*, you'll be able to obtain new *access 
token*s (the tokens you pass in your API requests) as needed.

Each *access token* expires in roughly one hour, but if you have a *refresh 
token* you can get a new *access token* without prompting the user again. 
The Ruby client library handles this process for you. All you have to do is 
configure your app with the *refresh token* as described here 
<https://github.com/googleads/google-api-ads-ruby/wiki/OAuth2>.

Thanks,
Josh, AdWords API Team

On Tuesday, March 10, 2015 at 6:28:43 PM UTC-4, Eric Berry wrote:
>
> I am writing an app which automatically imports cost data for adwords 
> campaigns. This is something that runs in a Rails app and is triggered by a 
> cron job. A user is not logged into the app in order for it to be triggered.
>
> I have created an application-based client id and with it, generated an 
> access token and refresh token.
>
> Does this access token last or do I need to have something in my system 
> refresh the token? If so, are there any examples of how to do this without 
> an actual user clicking and pasting stuff? I'm certain this is a problem 
> that others have solved already and I my head is starting to hurt trying to 
> figure it out.
>
> Thanks,
>
> Eric
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/58a49fee-871d-4823-aec6-ab216fee5594%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to