grpc: Index | Files

package oauth

import ""

Package oauth implements gRPC credentials using OAuth.


Package Files


func NewApplicationDefault Uses

func NewApplicationDefault(ctx context.Context, scope ...string) (credentials.PerRPCCredentials, error)

NewApplicationDefault returns "Application Default Credentials". For more detail, see

func NewComputeEngine Uses

func NewComputeEngine() credentials.PerRPCCredentials

NewComputeEngine constructs the PerRPCCredentials that fetches access tokens from Google Compute Engine (GCE)'s metadata server. It is only valid to use this if your program is running on a GCE instance. TODO(dsymonds): Deprecate and remove this.

func NewJWTAccessFromFile Uses

func NewJWTAccessFromFile(keyFile string) (credentials.PerRPCCredentials, error)

NewJWTAccessFromFile creates PerRPCCredentials from the given keyFile.

func NewJWTAccessFromKey Uses

func NewJWTAccessFromKey(jsonKey []byte) (credentials.PerRPCCredentials, error)

NewJWTAccessFromKey creates PerRPCCredentials from the given jsonKey.

func NewOauthAccess Uses

func NewOauthAccess(token *oauth2.Token) credentials.PerRPCCredentials

NewOauthAccess constructs the PerRPCCredentials using a given token.

func NewServiceAccountFromFile Uses

func NewServiceAccountFromFile(keyFile string, scope ...string) (credentials.PerRPCCredentials, error)

NewServiceAccountFromFile constructs the PerRPCCredentials using the JSON key file of a Google Developers service account.

func NewServiceAccountFromKey Uses

func NewServiceAccountFromKey(jsonKey []byte, scope ...string) (credentials.PerRPCCredentials, error)

NewServiceAccountFromKey constructs the PerRPCCredentials using the JSON key slice from a Google Developers service account.

type TokenSource Uses

type TokenSource struct {

TokenSource supplies PerRPCCredentials from an oauth2.TokenSource.

func (TokenSource) GetRequestMetadata Uses

func (ts TokenSource) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

GetRequestMetadata gets the request metadata as a map from a TokenSource.

func (TokenSource) RequireTransportSecurity Uses

func (ts TokenSource) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether the credentials requires transport security.

Package oauth imports 8 packages (graph) and is imported by 108 packages. Updated 2020-11-10. Refresh now. Tools for package owners.