Code: 403. Errors: permission denied - while making API call to Hashicorp Vault

14,056

Solution 1

I was able to solve the simply use set VAULT_TOKEN=00000000-0000-0000-0000-000000000000

There is change in creating key-value in Hashicorp Vault now. Use kv put instead of write.

>vault kv put secret/gs-vault-config example.username=demouser example.password=demopassword
Key              Value
---              -----
created_time     2018-12-26T14:25:07.5400739Z
deletion_time    n/a
destroyed        false
version          1

>vault kv put secret/gs-vault-config/cloud example.username=clouduser example.password=cloudpassword
Key              Value
---              -----
created_time     2018-12-26T14:25:53.0980305Z
deletion_time    n/a
destroyed        false
version          1

enter image description here

Solution 2

In windows,

Step1:

set the VAULT_TOKEN & VAULT_ADDR

SET VAULT_TOKEN=00000000-0000-0000-0000-000000000000

SET VAULT_ADDR=http://127.0.0.1:8200

Step 2: put the secret key & password using kv put

vault kv put secret/gs-vault-config example.username=hello example.password=world
Share:
14,056
PAA
Author by

PAA

I am Sr. Software Engineer having 11 years of experience in Microservices, Spring Boot, Spring Batch, Spring Rest, Spring Security, Java 8, WSO2 API Manager. I also have experience in Postgres, Oracle, MongoDB and Redis. I've have extensive experience in writing Mockito based Test cases, Junit and TestNG.

Updated on June 22, 2022

Comments

  • PAA
    PAA about 2 years

    I'm following Vault Configuration example referring from: https://spring.io/guides/gs/vault-config/. I've started server using windows machine.

    vault server --dev --dev-root-token-id="00000000-0000-0000-0000-000000000000"
    

    two environment variables to point the Vault CLI to the Vault endpoint and provide an authentication token.

    set VAULT_TOKEN="00000000-0000-0000-0000-000000000000"
    set VAULT_ADDR=http://127.0.0.1:8200
    

    I am getting below error:

    C:\Softwares\vault_1.0.1_windows_amd64>vault write secret/gs-vault-config example.username=demouser example.password=demopassword
    Error writing data to secret/gs-vault-config: Error making API request.
    
    URL: PUT http://127.0.0.1:8200/v1/secret/gs-vault-config
    Code: 403. Errors:
    
    * permission denied
    

    enter image description here

  • f.trajkovski
    f.trajkovski over 3 years
    It still says permission denied, I followed both of your steps
  • Adiii
    Adiii over 2 years
    you need to run vault login