--session flag not working with op list items

beantaxi
beantaxi
Community Member

I cannot get the --session flag to work with 1Password CLI commands, eg op list items, even when I use a valid session token.

E.g. this works ...

$ OP_SESSION_my=this-is-not-the-real-token op list items
[{"uuid": "(... valid item data ...)"

... but this doesn't (with the same token as above)

$ op list items --session this-is-not-the-real-token
[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 subdomain) -- everything works except the --session flag.

I also posted this in SO as https://stackoverflow.com/questions/60348907/1password-cli-op-cannot-get-the-session-flag-to-work-with-any-commands, with no luck.

Any ideas?

Thanks!


1Password Version: 0.91
Extension Version: Not Provided
OS Version: OSX 10.15.3
Sync Type: Not Provided

Comments

  • felix_1p
    felix_1p
    1Password Alumni

    Hi @beantaxi! This is a known issue and is related to how we do command line argument processing. It will be fixed in an upcoming version but for now you have to include a = when specifying the token value:

    --session=this-is-not-the-real-token
    

    Sorry for the inconvenience.

  • beantaxi
    beantaxi
    Community Member
    edited February 2020

    Thanks! No big deal, and I'm glad I have a simple workaround.

    If it's going to be a while till the next release, is it worth fixing in the --help to reflect reality?

    Usage:
      op list items [flags]
    
    Flags:
      -h, --help            help for items
          --include-trash   Include items in the Trash
          --vault <vault>   List items in <vault>. Specify <vault> by name or UUID.
    
    Global Flags:
          --account string   account to use when multiple sessions are active
          --session string   raw session token obtained via 'op signin --raw'
    

    If this said --session=string we'd be all set.

    Also, did the error messages change from 0.9.1 from 0.9.2? I just noticed this, on an expected failure:

    $ op list items [LOG] 2020/02/24 12:59:22 (ERROR) 401: Authentication required.

    I feel like this used to say "You are not signed in" or something similar. No issue here -- I'm not parsing error messages or anything crazy -- I'm just curious.

    Thanks again!

  • felix_1p
    felix_1p
    1Password Alumni

    Thank you for being understanding!

    If it's going to be a while till the next release, is it worth fixing in the --help to reflect reality?

    That's a reasonable idea but since the help text is auto-generated it's probably more of an effort to customize it than to fix the parameter parsing.

    Also, did the error messages change from 0.9.1 from 0.9.2? I just noticed this, on an expected failure:

    I'll have to investigate that, thank you for pointing that out!

This discussion has been closed.