Skip to content

Commit

Permalink
fix(login): lookup token self
Browse files Browse the repository at this point in the history
  • Loading branch information
FalcoSuessgott committed Nov 18, 2023
1 parent 4965426 commit 6dda552
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/vault/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewDefaultClient() (*Vault, error) {
}

if vaultToken == "" {
return nil, fmt.Errorf("VAULT_TOKEN required but not set")
return nil, fmt.Errorf("VKV_LOGIN_COMMAND or VAULT_TOKEN required but not set")
}

config := api.DefaultConfig()
Expand All @@ -56,9 +56,9 @@ func NewDefaultClient() (*Vault, error) {
c.SetNamespace(vaultNamespace)
}

_, err = c.Auth().Token().Lookup(vaultToken)
_, err = c.Auth().Token().LookupSelf()
if err != nil {
return nil, fmt.Errorf("not authenticated. Perhaps not a valid token")
return nil, fmt.Errorf("not authenticated. Perhaps not a valid token: %w", err)
}

return &Vault{Client: c}, nil
Expand Down

0 comments on commit 6dda552

Please sign in to comment.