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)
| 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. |
| 139 | func (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. |
no test coverage detected