aquarat / google-api-go-client

Automatically exported from code.google.com/p/google-api-go-client
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Server to server authentication examples #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.
I want to know y there are more examples for Server to Server Oauth2.
i need my server internally keeps feeding from analytics data but the standard 
auth access only let me get a 1 hour permission.

can be the documentation be more specific in how to make this possible?

Original issue reported on code.google.com by neoyag...@gmail.com on 14 Oct 2013 at 5:08

GoogleCodeExporter commented 9 years ago
It looks like the right way to do this is using "JWTs" 
(https://developers.google.com/accounts/docs/OAuth2ServiceAccount). It's 
unclear whether or not this library actually has support for the JWT Server To 
Server flow.

Original comment by stevv...@gmail.com on 9 Jan 2014 at 2:20

GoogleCodeExporter commented 9 years ago
@neoyag: the right way to do "headless" server-to-server oauth2 to (for 
example) query analytics data is indeed JWT, especially if you don't even want 
to have to fiddle around with authenticating over and over again. 

@stevv: the google-go-api-client definitely has support for this flow. 

see my example code here https://gist.github.com/rickt/7ac4f90f563a4215674b -- 
i use JWT to query and download analytics data, hopefully its exactly what 
you're looking for. 

let me know if you have any questions.

Original comment by ri...@rickt.org on 7 Mar 2014 at 7:34

GoogleCodeExporter commented 9 years ago
sorry for a second message, but i wrote a blog post about the pre-requisites to 
doing headless/server-to-server oauth when querying analytics data, it might 
also help... 
http://code.rickt.org/2014/03/how-to-download-google-analytics-data.html

Original comment by ri...@rickt.org on 7 Mar 2014 at 7:41

GoogleCodeExporter commented 9 years ago
gist link is broken

Original comment by gpe...@cliftoncollege.com on 9 Sep 2014 at 1:35

GoogleCodeExporter commented 9 years ago
@gpe you're right! :( take a look at 
https://gist.github.com/rickt/0c701ea850f6fc4a3301 and 
https://gist.github.com/karalabe/8933476. the 2nd example uses the newer way of 
using JWT.

Original comment by ri...@rickt.org on 9 Sep 2014 at 1:41