nyxcharon / vault-ui

A webapp for working with Hashicorp's Vault https://github.com/hashicorp/vault
GNU General Public License v3.0
140 stars 22 forks source link

Unable to Login - No JSON object could be decoded #34

Open vikas027 opened 7 years ago

vikas027 commented 7 years ago

Hello,

In my test environment, I am running Vault 0.6.4 with Consul 0.7.2 backend and have created few users which are working as expected on CLI.

🍺  ~$ vault auth -method=userpass username=vikas
Password (will be hidden):
Successfully authenticated! You are now logged in.
The token below is already saved in the session. You do not
need to "vault auth" again with the token.
token: b0459465-e88a-0f49-54ee-13f908605e64
token_duration: 2764799
token_policies: [admins default]
🍺  ~$
🍺  ~$ vault write secret/project/myproject/hello value=vikas
Success! Data written to: secret/project/myproject/hello
🍺  ~$

But, I am unable to login thru the UI. This my basic compose file and the error logs.

# cat docker-compose.yml
version: '2'

services:
  vault:
    image: "nyxcharon/vault-ui:latest"
    container_name: vault-ui
    ports:
      - 80:80
    environment:
      - VAULT_ADDR=http://192.168.1.81
      - VAULT_PORT=8200
      - AUTH_METHODS=Userpass
#

These are the errors of docker container

# docker logs -f vault-ui
[pid: 14|app: 0|req: 11/13] 172.21.0.1 () {40 vars in 550 bytes} [Sat Dec 31 11:28:50 2016] POST /v1/auth/userpass/login/vikas => generated 1528 bytes in 1 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 0)
[pid: 14|app: 0|req: 11/14] 192.168.1.1 () {46 vars in 874 bytes} [Sat Dec 31 11:28:50 2016] POST /login?next=http%3A%2F%2F192.168.1.81%2F => generated 2760 bytes in 13 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 1)
Error logging in: No JSON object could be decoded
[pid: 14|app: 0|req: 12/15] 192.168.1.1 () {40 vars in 630 bytes} [Sat Dec 31 11:28:50 2016] GET /static/app.css => generated 1363 bytes in 1 msecs via sendfile() (HTTP/1.1 200) 7 headers in 279 bytes (0 switches on core 0)

This is the error on Web UI 2016-12-31_22-30-30

nyxcharon commented 7 years ago

This is likely due to VAULT_SKIP_VERIFY not being set to "True". If you do want to verify the cert, make sure to set all the settings as needed for it.

vikas027 commented 7 years ago

@nyxcharon I am not using any cert. I did tried the variable, but still no luck.

This is the error

[pid: 24|app: 0|req: 1/3] 172.21.0.1 () {40 vars in 550 bytes} [Fri Jan  6 09:48:19 2017] POST /v1/auth/userpass/login/vikas => generated 1528 bytes in 18 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 0)
Error logging in: No JSON object could be decoded
[pid: 23|app: 0|req: 1/4] 192.168.1.1 () {46 vars in 874 bytes} [Fri Jan  6 09:48:19 2017] POST /login?next=http%3A%2F%2F192.168.1.81%2F => generated 2760 bytes in 45 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 0)