Automatic permission to use Google APIs in Go
I am trying to find a way to interact with Google APIs (specifically the Compute Engine API) without user authorization from the consent screen every time I need to re-contact Google.
Requests will be executed when the user is not present, so no authorization through the consent screen is required is an absolute must.
I am using Go client library and Go API.
Can someone please explain the method to achieve what I need?
source to share
You should take a look at service accounts. They use a public / private key pair to authorize calls to the Google API.
The Google Developers have one very good document explaining how service accounts work:
https://developers.google.com/accounts/docs/OAuth2ServiceAccount
Here's how to create a service account:
https://developers.google.com/console/help/new/#serviceaccounts
You will also find code samples in the first document, but unfortunately not in Go. However, there are some comments I found here:
https://code.google.com/p/google-api-go-client/wiki/GettingStarted
Hope it helps.
source to share