serviceaccount

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Overview

Package serviceaccount provides functions for working with Google service accounts.

See https://developers.google.com/identity/protocols/oauth2/service-account.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Type         string `json:"type"`
	ProjectID    string `json:"project_id"`
	PrivateKeyID string `json:"private_key_id"`
	PrivateKey   string `json:"private_key"`
	ClientEmail  string `json:"client_email"`
	ClientID     string `json:"client_id"`
	AuthURI      string `json:"auth_uri"`
	TokenURI     string `json:"token_uri"`
}

Key represents a service account key.

func LoadKey

func LoadKey(b []byte) (*Key, error)

LoadKey loads service account key from JSON byte slice.

func (*Key) AccessToken

func (k *Key) AccessToken(ctx context.Context, client *http.Client, scopes ...string) (string, error)

AccessToken obtains an access token for service account identified by this key that is valid for one hour.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL