MCPcopy
hub / github.com/larksuite/cli / resolveUAT

Method resolveUAT

internal/credential/default_provider.go:139–158  ·  view source on GitHub ↗

resolveUAT resolves a user access token. Not cached (unlike TAT) because UAT may be refreshed between calls and GetValidAccessToken handles its own caching.

(ctx context.Context)

Source from the content-addressed store, hash-verified

137// resolveUAT resolves a user access token. Not cached (unlike TAT) because UAT
138// may be refreshed between calls and GetValidAccessToken handles its own caching.
139func (p *DefaultTokenProvider) resolveUAT(ctx context.Context) (*TokenResult, error) {
140 acct, err := p.defaultAcct.ResolveAccount(ctx)
141 if err != nil {
142 return nil, err
143 }
144 httpClient, err := p.httpClient()
145 if err != nil {
146 return nil, err
147 }
148 token, err := auth.GetValidAccessToken(httpClient, auth.NewUATCallOptions(acct.ToCliConfig(), p.errOut))
149 if err != nil {
150 return nil, err
151 }
152 stored := auth.GetStoredToken(acct.AppID, acct.UserOpenId)
153 scopes := ""
154 if stored != nil {
155 scopes = stored.Scope
156 }
157 return &TokenResult{Token: token, Scopes: scopes}, nil
158}
159
160// resolveTAT resolves a tenant access token. The result is cached after the first
161// call via sync.Once — only the context from the first call is used.

Callers 1

ResolveTokenMethod · 0.95

Calls 5

GetValidAccessTokenFunction · 0.92
NewUATCallOptionsFunction · 0.92
GetStoredTokenFunction · 0.92
ToCliConfigMethod · 0.80
ResolveAccountMethod · 0.65

Tested by

no test coverage detected