Fix oauth2Config.Exchange error reporting (#3003)

This commit is contained in:
Martin
2023-08-29 00:35:53 +02:00
committed by GitHub
parent bf733f3822
commit b6d4c62edd

View File

@@ -323,13 +323,13 @@ func (client *Provider) VerifyIdentity(ctx context.Context, code, state, roleARN
getWebTokenExpiry := func() (*credentials.WebIdentityToken, error) {
customCtx := context.WithValue(ctx, oauth2.HTTPClient, client.provHTTPClient)
oauth2Token, err := client.oauth2Config.Exchange(customCtx, code)
client.RefreshToken = oauth2Token.RefreshToken
if err != nil {
return nil, err
}
if !oauth2Token.Valid() {
return nil, errors.New("invalid token")
}
client.RefreshToken = oauth2Token.RefreshToken
expiration := token.GetConsoleSTSDuration()
if exp := getIDPTokenExpiration(); exp > 0 {