Unable to get admin_api_key working for docker compose (Poor man's auth)

Steps to reproduce

  1. run docker-compose up
version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    environment:
      DGRAPH_ALPHA_SECURITY: token=abcdefghijkl
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security whitelist=0.0.0.0/0
  ratel:
    image: dgraph/ratel
    ports:
      - 8000:8000
    command: dgraph-ratel

  1. curl -s localhost:8080/alter -d ‘{ “drop_all”: true }’

Its coming success ideally it should have been
Permission denied. No token provided.

Reference from docs

Is it because you are specifying some of the security flag with environment and some with flags? Try all one way or the other maybe.

1 Like

Thanks for addressing my issue, got it working found solution in previous discussions, just leaving here because someone may find it helpful

dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "token=<secretToken>; whitelist=0.0.0.0/0"