Iwark/spreadsheet

Will this only work with service accounts?

Closed this issue · 1 comments

I am writing a project that uses google.golang.org/api/drive/v3 and also this library. The drive library expects client auth credentials but this project seems to expect a service account. is there a way to use a unified set of credentials for both?

Sorry found how to pass the client using the same stuff used in the google api

func newSheetClient() *spreadsheet.Service{
	client := googleClient()
	srv := spreadsheet.NewServiceWithClient(client)
	return srv
}

func googleClient() *http.Client{
	ctx := context.Background()

	b, err := ioutil.ReadFile("client_secret.json")
	if err != nil {
		log.Fatalf("Unable to read client secret file: %v", err)
	}

	config, err := google.ConfigFromJSON(b, SCOPES...)
	if err != nil {
		log.Fatalf("Unable to parse client secret file to config: %v", err)
	}
	client := getClient(ctx, config)
	return client
}