I am trying to set up headlessly-synced vault on my VPS via docker-compose, using node:bookworm as a base image.
One thing I do not quite understand is OBSIDIAN_AUTH_TOKEN variable ( Obsidian Headless - Obsidian Help ). How does one get it? I could not find any reference in docs and in Obsidian UI.
I’ve tried setting it to a random string and it did not seem to work.
I have also tried to authenticate via “ob login” and even though id does say “logged in as (my email) ”, when I run plain “ob login” again immediately after that, it says “not logged in”.
What am I missing? Maybe I’m using the wrong base image? Perhaps docs should be a bit more concrete on that matter?
To my understanding there is not a easy/supported way to get the token without an interactive environment where you need to ob login first. Even then, the token is stored on the user’s keychain.
Here’s what I did:
ob login through the normal flow with my email, password, mfa
I used find ~ -path "*obsidian-headless*" 2>/dev/nullto search for the token.
The token was in /home/[my username]/.config/obsidian-headless/auth_token
Use that token in your docker-compose or export it as an environment variable etc…
Note: if you ever ob logout it will delete that auth token and invalidate it.