Search code examples
gogoogle-analyticsgoogle-analytics-apigoogle-api-go-client

Server to server OAuth2


I'm trying to implement a Golang application for accessing Google Analytics data. but all the examples uses tokens that dies in one hour. In the api access i found a "Certificate access" that are designed to be used to access from servers, but i failed to find examples of its implementation in Golang. there is some reading or may you can enlighten my path for this?

I'm using this library. code.google.com/p/google-api-go-client/

reading some post here I found this Service Applications and Google Analytics API V3: Server-to-server OAuth2 authentication?

but it seems that it will not work directly. is really no way of doing this w/o hacking it around?


Solution

  • have you checked out the OAuth2 package? I've used it for user-authorised calls, and hacked it around a bit to allow it to handle multiple authorisation sources.

    I haven't tested it with pure server-to-server comms, but you should be able to hack the transport code to get it to do what it needs...