Skip to content

Commit 8a0522b

Browse files
committed
validate 200 returned for auth request
Signed-off-by: Kobbi Gal <[email protected]>
1 parent 5d28332 commit 8a0522b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

secretstores/akeyless/akeyless.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,9 @@ func (a *akeylessSecretStore) Authenticate(ctx context.Context, metadata *akeyle
495495
a.v2 = akeyless.NewAPIClient(config).V2Api
496496

497497
a.logger.Debug("authenticating with Akeyless...")
498-
out, _, err := a.v2.Auth(ctx).Body(*authRequest).Execute()
499-
if err != nil {
500-
return fmt.Errorf("failed to authenticate with Akeyless: %w", err)
498+
out, httpResponse, err := a.v2.Auth(ctx).Body(*authRequest).Execute()
499+
if err != nil || httpResponse.StatusCode != 200 {
500+
return fmt.Errorf("failed to authenticate with Akeyless: %w", errors.New(httpResponse.Status))
501501
}
502502

503503
a.logger.Debugf("authentication successful - token expires at %s", out.GetExpiration())

0 commit comments

Comments
 (0)