MCPcopy
hub / github.com/grpc/grpc-go / newCredentialsCallOption

Function newCredentialsCallOption

examples/features/authz/client/main.go:85–92  ·  view source on GitHub ↗
(t token.Token)

Source from the content-addressed store, hash-verified

83}
84
85func newCredentialsCallOption(t token.Token) grpc.CallOption {
86 tokenBase64, err := t.Encode()
87 if err != nil {
88 log.Fatalf("encoding token: %v", err)
89 }
90 oath2Token := oauth2.Token{AccessToken: tokenBase64}
91 return grpc.PerRPCCredentials(oauth.TokenSource{TokenSource: oauth2.StaticTokenSource(&oath2Token)})
92}
93
94func main() {
95 flag.Parse()

Callers 1

mainFunction · 0.85

Calls 3

PerRPCCredentialsFunction · 0.92
FatalfMethod · 0.65
EncodeMethod · 0.45

Tested by

no test coverage detected