Authentication from a server without a browser

201 views
Skip to first unread message

Peter Forth

unread,
Apr 8, 2015, 1:21:26 PM4/8/15
to adsen...@googlegroups.com
I am trying to download our adsense account's spend for our reporting system.  Since my tool is going to be running on a remotely hosted server and just accessing our single account, I initially I tried using a "service account".  This seems to have been a dead end.  That being said, it also doesn't seem appropriate to use a "web" or "installed" credential since these type of credentials require you to open up a url in a web browser... something that is not available if you are running on a remote server via ssh.  Surely you can't just hit the url from another computer with a different ip address?

My current reference for this can be found at: https://cloud.google.com/compute/docs/tutorials/python-guide

I also notice that it spends a lot of code parsing command line parameters, but doesn't actually seem to pass any in.  What is the purpose of the command line parameter parsing.

Dean Lukies (Adsense API Team)

unread,
Apr 8, 2015, 1:27:26 PM4/8/15
to adsen...@googlegroups.com
Hi Peter,

Service Accounts do not work with Adsense.

What you need to do is authenticate once, then store the returned token and reuse it for future calls.
Most of the examples ( https://developers.google.com/adsense/management/libraries ) do this (some may require a change depending on the language) - look for offline access

thanks,
Dean

Peter Forth

unread,
Apr 20, 2015, 9:07:45 AM4/20/15
to adsen...@googlegroups.com
What if you are running the program on a remote server that does not have a gui or browser?  Can you authenticate once on a different machine (for example a developer machine) and copy the token to the machine with the server running-- or is the credential bound to the original authenticating machine's ip address?

Thanks,
Peter

Dean Lukies (Adsense API Team)

unread,
Apr 20, 2015, 9:17:52 AM4/20/15
to adsen...@googlegroups.com
Hi Peter,
Can you authenticate once on a different machine (for example a developer machine) and copy the token to the machine with the server running
Yes; if you have no GUI or web service running on the machine, that will work.  The tokens are very long lived.

Thanks,
Dean
Reply all
Reply to author
Forward
0 new messages