MCPcopy Create free account
hub / github.com/openclaw/gogcli / tokenSourceForServiceAccountScopes

Function tokenSourceForServiceAccountScopes

internal/googleapi/service_account.go:40–67  ·  view source on GitHub ↗
(
	ctx context.Context,
	dependencies AuthDependencies,
	serviceLabel string,
	email string,
	scopes []string,
)

Source from the content-addressed store, hash-verified

38}
39
40func tokenSourceForServiceAccountScopes(
41 ctx context.Context,
42 dependencies AuthDependencies,
43 serviceLabel string,
44 email string,
45 scopes []string,
46) (oauth2.TokenSource, string, bool, error) {
47 store, err := dependencies.serviceAccountStore()
48 if err != nil {
49 return nil, "", false, err
50 }
51
52 file, exists, err := store.Read(email, serviceLabel == "keep")
53 if err != nil {
54 return nil, "", false, fmt.Errorf("read service account: %w", err)
55 }
56
57 if !exists {
58 return nil, "", false, nil
59 }
60
61 ts, err := dependencies.serviceAccountTokenSource(ctx, file.Data, email, scopes)
62 if err != nil {
63 return nil, "", false, err
64 }
65
66 return ts, file.Path, true, nil
67}

Calls 4

serviceAccountStoreMethod · 0.80
ErrorfMethod · 0.80
ReadMethod · 0.45