File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
cmd/collectors/storagegrid/rest Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,17 @@ func (c *Client) invoke() ([]byte, error) {
209209 var storageGridErr errs.StorageGridError
210210 if errors .As (err , & storageGridErr ) {
211211 if storageGridErr .IsAuthErr () {
212+ // If using authToken from credential script, expire cache before retry
213+ // so fetchTokenWithAuthRetry gets fresh token instead of cached expired one
214+ pollerAuth , authErr := c .auth .GetPollerAuth ()
215+ if authErr != nil {
216+ return nil , authErr
217+ }
218+ if pollerAuth .HasCredentialScript && pollerAuth .AuthToken != "" {
219+ c .Logger .Debug ("Expiring cached credential script token after 401 response" )
220+ c .auth .Expire ()
221+ }
222+
212223 err2 := c .fetchTokenWithAuthRetry ()
213224 if err2 != nil {
214225 return nil , err2
You can’t perform that action at this time.
0 commit comments