ruby - Using Google APIs from automated task with OAuth -
i have regular, automated task needs query user data within google analytics api. must able run without manual intervention.
(details, details: i'm presently using ruby gems legato
, oauth
queries.)
as best can tell, because want query user data on google analytics, must use oauth 2.0. yet access token acquire expires after 1 hour, , refresh token appears work in presence of valid access token(?).
i've obtained long-living oauth 1.0a token twitter bot script runs daily cron job. it's been running daily several years nary problem.
it appears google/oauth 2.0, have acquire token manually, have task refresh token occasionally, , re-acquire token manually if job ever die. have hard time believing case. missing?
oh, hello, it's called service account. initial, cursory reading of google's docs had me thinking service accounts not access user data, turns out correct way it.
Comments
Post a Comment