Gists
This is a sample golang script for retrieving access token using Service Account of Google by Google’s OAuth2 package.
The script without using Google’s OAuth2 package is here.
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/jwt"
)
func serviceAccount(credentialFile string) (*oauth2.Token, error) {
b, err := ioutil.ReadFile(credentialFile)
if err != nil {
return nil, err
}
var c = struct {
Email string `json:"client_email"`
PrivateKey string `json:"private_key"`
}{}
json.
Overview This is a Golang library to retrieve access token from Service Account of Google without using Google’s OAuth2 package.
You can get this from https://github.com/tanaikech/go-gettokenbyserviceaccount
Gists
Updated on June 22, 2024
This is a sample script for retrieving the access token for Service Account using Google Apps Script. The flow for using this script is as follows.
Usage Create the Service Account and retrieve JSON file. Put Scopes, private_key and client_email as an object. If you want to use impersonate email, please set the value of impersonate_email. Run the script. /** * ### Description * Get access token from service account.
v1.0.1 (December 5, 2018)
When the filename have not been retrieved, an error have occurred. This bug was removed. You can see the detail information here https://github.com/tanaikech/DownloadLargeFilesByUrl
ggsrun was updated to v.1.6.0 v1.6.0 (November 30, 2018) Although at ggsrun, files can be searched by filename and file ID, searching files using search query and regex couldn’t be done. From version 1.6.0, files got to be able to be searched using the search query and regex. $ ggsrun sf -q "### search query ###" -f "### fields ###" -r "### regex ###" Some modifications.