Skip to content

chore(loo-4727): multiple keys and teams#25

Merged
notnmeyer merged 12 commits intomainfrom
chore/loo-4727/multiple-keys-and-teams
Mar 23, 2026
Merged

chore(loo-4727): multiple keys and teams#25
notnmeyer merged 12 commits intomainfrom
chore/loo-4727/multiple-keys-and-teams

Conversation

@notnmeyer
Copy link
Copy Markdown
Member

@notnmeyer notnmeyer commented Mar 21, 2026

refactors how keys are stored to support multiple teams. a config file is used to store a user-supplied name for a key. that name is used to look up the key from the secret store,

auth login|logout require naming keys with --name/-n,

➜ loops login --name staging
Enter your API key:
API key saved as "staging". Authenticated as team: nate-send4.l3s.email

➜ loops login --name prod
Enter your API key:
API key saved as "prod". Authenticated as team: Loops

keys can be listed,

➜ task -- auth list
NAME      API KEY
staging   ****************************abcd
prod      ****************************efgh

a global flag --team/-t can be used to specify the team,

➜ loops lists list -t staging
ID                         NAME                 DESCRIPTION        PUBLIC
cm9j0iv8g0asd0iym9dcwa6qm  SPAM                                    false
cmmz0d86p0sdf0iy1bsrf14r4  Cold Email Outreach  ALWAYS BE CLOSING  false

you can set an "active" team. the active team is used when --team or LOOPS_API_KEY is not supplied. loops auth set team-name sets the team,

➜ loops auth use staging
Active team set to "staging".

if an active team is set, it shown in the list output,

➜ loops auth list
NAME               API KEY
staging (active)   ****************************abcd
prod               ****************************efgh

unset the active team with loops auth use --clear,

➜ loops auth use --clear
Active team cleared.

@notnmeyer notnmeyer self-assigned this Mar 21, 2026
@linear
Copy link
Copy Markdown

linear bot commented Mar 21, 2026

LOO-4727

@notnmeyer notnmeyer requested review from nalanj March 23, 2026 13:27
@nalanj
Copy link
Copy Markdown

nalanj commented Mar 23, 2026

@notnmeyer I like the shape of this. Does it use the only key by default, if there is only one?

@notnmeyer
Copy link
Copy Markdown
Member Author

@nalanj not really, but if LOOPS_API_KEY is set, it is used no matter what (im picturing ci). otherwise an active key or --team needs to be set. that said, i think what you're suggesting is a good idea. ill take a look.

@notnmeyer
Copy link
Copy Markdown
Member Author

notnmeyer commented Mar 23, 2026

actually, when you log in loops auth login --name blah it becomes the active key. so, yeah, i guess in that case it would use the only key by default. that wouldn't stop you from unsetting the active key. if LOOPS_API_KEY is not set, no --team is supplied, and no active key is set you'd get an error.

@nalanj
Copy link
Copy Markdown

nalanj commented Mar 23, 2026

@notnmeyer I think in the default case of one login it should just always do what you'd expect, rather than erroring for you to choose from the one team you have defined

@notnmeyer
Copy link
Copy Markdown
Member Author

notnmeyer commented Mar 23, 2026

➜ task -- auth list
NAME     API KEY
staging  ****************************blah

➜ task -- transactional list
ID                         NAME                 LAST UPDATED              VARIABLES
cm9bkshgz0000uj0qbjbzrgqw  Attachments Test     2026-03-02T21:44:46.302Z
cmkzxyhsr00050i1rw7w1f6b7  Blank transactional  2026-02-05T04:36:29.163Z
cmm3usezb00010iyhtfok5ulf  transactional test   2026-03-20T00:00:49.178Z  var1, var2, items[].array-val, reply-to, cc
cmmf9qifa00000iz9bhmb3ob0  Blank transactional  2026-03-19T23:25:09.238Z
cmmy3s18z000g0i1oc3qtnwby  empty array error    2026-03-19T23:30:58.824Z
cmmy7gjdq00000i2ylgb5xwnu  Blank transactional  2026-03-20T01:13:34.389Z
➜ task -- auth list
NAME     API KEY
staging  ****************************blah
prod     ****************************blah

➜ task -- transactional list
Error: no active team set — run `loops auth login --name <name>` to authenticate
exit status 1
task: Failed to run task "default": exit status 1

@notnmeyer
Copy link
Copy Markdown
Member Author

and one more unrelated change. moves the active indicator to its own column in text output,

➜ task -- auth list
NAME     API KEY                           ACTIVE
staging  ****************************blah
prod     ****************************blah  *

@notnmeyer notnmeyer merged commit a1d670e into main Mar 23, 2026
2 checks passed
@notnmeyer notnmeyer deleted the chore/loo-4727/multiple-keys-and-teams branch March 30, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants