1Password CLI (op): Cannot get the `--session` flag to work with any commands

660 Views Asked by At

I cannot get the --session flag to work with 1Password CLI commands.

I use a valid session token.

Working Example

op list items without session flag works:

$ OP_SESSION_my=XXXXX-this-is-not-the-real-token-XXXXX op list items
[{"uuid": "asdfghj etc etc etc"

Failing Example

But op list items with session flag and same token as above doesn't:

$ op list items --session XXXXX-this-is-not-the-real-token-XXXXX
[LOG] 2020/02/21 22:48:59 (ERROR)  Invalid session token

I can do anything I want with a valid session token:

  • obtain it via op signin --raw
  • assign it with eval $(op signin etc)

Every command works, but not when using the --session flag.

Any ideas?

1

There are 1 best solutions below

0
On

On the 1Password CLI forums, I was told this was a known issue. As a workaround, --session=YOUR_SESSION_TOKEN does work. The docs do not specify the = but for now it works. E.g. op list items --session=XXXXX-this-is-not-the-real-token-XXXXX