Doppler CLI with two different accounts

So I have a weird situation. I have a personal free account and a teams account for work. When I try to use the CLI with my teams account, I can authenticate and get to the teams account dashboard, but when I check my configuration using the CLI, I get the project from my personal account. It looks like something is being cached but I don’t know for sure. If anyone has any thoughts or suggestions, I’d appreciate it.

Hey Bruce!

The best solution is to scope each account to a different parent directory on your machine.

I’d also recommend using either separate browsers or separate profiles within Chrome so you can also manage access to the dashboards from both accounts.

By default when you run doppler login, it sets the scope (parent directory) to root / as most developers will only ever access a single workplace.

So the process will be to clear out your existing token, then re-authenticate both accounts, but with different root directories.

To get started, clear the token at the root level by running:

doppler logout

Step 1. Authenticate Work Account

Then, presuming you have a directory structure like /home/bruce/work and /home/bruce/personal.

First, authenticate your Work account.

But instead of auto opening the window, type n and manually copy the https://dashboard.doppler.com/workplace/auth/cli URL and paste it into the browser that 's authenticated for your Work account:

doppler login --scope /home/bruce/work

Then paste in the auth code to complete authenticating the CLI.

What you should now find is that CLI commands outside of /home/bruce/work will fail as they don’t have a token associated with that path.

You can verify this worked by changing into your Work directory and listing the projects:

cd /home/bruce/work
doppler projects

Step 2. Authenticate Personal Account

This is essentially the same as step 1, except the scope will change:

doppler login --scope /home/bruce/personal

Again type n and this time, copy and paste https://dashboard.doppler.com/workplace/auth/cli into the browser where your Personal account is authenticated.

Then verify that worked by changing into your Personal directory and listing the projects:

cd /home/bruce/personal
doppler projects

As a final test step, change into the root folder for your user and the projects list should fail as it does not have a scoped directory as it’s parent:

cd $HOME
doppler projects # This should fail

Although I wouldn’t recommend this approach, you can also edit the Doppler config file at ~/.doppler/.doppler.yaml if you needed to make some adjustments in the future without having to re-authenticate.

Let me know how you go!

1 Like