Admin Token invalid - cant access admin page

So, I am trying to access the Vaultwarden admin page. I am pretty sure this has worked in the past, however I am unable to get it to work.

I generate a token on my main machine using

echo -n "password" | argon2 "$(openssl rand -base64 32)" -e -id -k 65540 -t 3 -p 4

Then I start my docker container with the following command:

docker  run -d  --name vw  --restart=unless-stopped  -e SIGNUPS_ALLOWED=true -e LOG_LEVEL=warn -e LOG_FILE=/data/vaultwarden.log -e ADMIN_TOKEN='$argon2id$v=19$m=65540,t=3,p=4$Z1N6S1JuZjE5ajZ2VXB0MUFkTFZPWUhPb0k2bUI4aFB3RFZFVXc2L3JmMD0$FMDQcvBfPhu+DMll9pFdF0KrSzHbzNTtuh1KL8Dc8JE'  -v ./vw-data/:/data/  -p 127.0.0.1:8080:80  vaultwarden/server:latest

I tried following the instructions in Enabling admin page · dani-garcia/vaultwarden Wiki · GitHub but I get an “Error: Invalid admin token, please try again.

I also tested with -e ADMIN_TOKEN=admin, and even that doesn’t work…

Anyone any idea what I am doing wrong here?

Exported my vault, erased all content in /data, recreated the container, recreated my account, re-imported my vault. ADMIN_TOKEN works and I can create settings.

Given it’s encrypted I would be tempted to just put it in the config file myself.

Then you can just change it at will in case you forget it.

1 Like

That makes sense…
What would be the switch to turn the admin page entirely off and on again?

Thank you!

If I recall right, if you just remove the line and restart the container the admin page will be disabled. I would just have a separate file in the config directory where you remove it from the config.json and paste it into something like unused-admin.json (or whatever- doesn’t matter.) That way you can just copy and paste it again and then restart the container when you do want the admin page available.

Depending on reverse proxy, you could also just limit bitwarden.mydomain.com/admin to only LAN IPs. Or only your specific desktop IP, etc. etc. etc.