Skip to content

Commit

Permalink
Merge pull request #2935 from shiftstack/reauth_context
Browse files Browse the repository at this point in the history
provider client: Reauthenticate with context
  • Loading branch information
EmilienM committed Feb 21, 2024
2 parents faaee35 + eaadf19 commit 729c1b8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions provider_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,7 @@ func (client *ProviderClient) SetThrowaway(v bool) {
// this case, the reauthentication can be skipped if another thread has already
// reauthenticated in the meantime. If no previous token is known, an empty
// string should be passed instead to force unconditional reauthentication.
func (client *ProviderClient) Reauthenticate(previousToken string) error {
ctx := context.TODO()

func (client *ProviderClient) Reauthenticate(ctx context.Context, previousToken string) error {
if client.ReauthFunc == nil {
return nil
}
Expand Down Expand Up @@ -490,7 +488,7 @@ func (client *ProviderClient) doRequest(ctx context.Context, method, url string,
}
case http.StatusUnauthorized:
if client.ReauthFunc != nil && !state.hasReauthenticated {
err = client.Reauthenticate(prereqtok)
err = client.Reauthenticate(ctx, prereqtok)
if err != nil {
e := &ErrUnableToReauthenticate{}
e.ErrOriginal = respErr
Expand Down

0 comments on commit 729c1b8

Please sign in to comment.