diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-02-05 10:55:51 +0100 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-02-05 10:55:51 +0100 |
| commit | 8df70c790e03a6b58a02c450122c61bc43478b5d (patch) | |
| tree | a0cd4cf02c3db7e24eb86fc1f6a3f791a4e5e681 /pkg/auth | |
| parent | 5896748e7b42c8f1b0cc2ceca4ba3dba2bed2618 (diff) | |
pkg/auth: retry https://oauth2.googleapis.com/tokeninfo call 3 times
Diffstat (limited to 'pkg/auth')
| -rw-r--r-- | pkg/auth/auth.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index 8b72c24f5..78d1dbeef 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -73,9 +73,16 @@ type jwtClaims struct { } func (auth *Endpoint) queryTokenInfo(tokenValue string) (*jwtClaims, error) { - resp, err := http.PostForm(auth.url, url.Values{"id_token": {tokenValue}}) + var resp *http.Response + var err error + for i := 0; i < 3; i++ { + resp, err = http.PostForm(auth.url, url.Values{"id_token": {tokenValue}}) + if err == nil { + break + } + } if err != nil { - return nil, fmt.Errorf("http.PostForm: %w", err) + return nil, fmt.Errorf("http.PostForm failed 3 times: %w", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { |
