MCPcopy Create free account
hub / github.com/UiPath/uipathcli / updateTokenResponseCache

Method updateTokenResponseCache

auth/oauth_authenticator.go:127–135  ·  view source on GitHub ↗
(config oauthAuthenticatorConfig, tokenResponse *tokenResponse)

Source from the content-addressed store, hash-verified

125}
126
127func (a OAuthAuthenticator) updateTokenResponseCache(config oauthAuthenticatorConfig, tokenResponse *tokenResponse) {
128 cacheKey := a.accessTokenCacheKey(config)
129 a.cache.Set(cacheKey, tokenResponse.AccessToken, tokenResponse.ExpiresAt.Add(-TokenExpiryGracePeriod))
130
131 if tokenResponse.RefreshToken != nil {
132 refreshTokenCacheKey := a.refreshTokenCacheKey(config)
133 a.cache.Set(refreshTokenCacheKey, *tokenResponse.RefreshToken, time.Now().UTC().Add(refreshTokenDefaultExpiry-TokenExpiryGracePeriod))
134 }
135}
136
137func (a OAuthAuthenticator) accessTokenCacheKey(config oauthAuthenticatorConfig) string {
138 identityBaseUri := config.IdentityUri

Callers 2

retrieveTokenMethod · 0.95
renewAuthTokenMethod · 0.95

Calls 4

accessTokenCacheKeyMethod · 0.95
refreshTokenCacheKeyMethod · 0.95
AddMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected