Feature request: multiple accounts simultaneously

mickael
mickael
Community Member

Hi,

It looks like that when you auth in multiple teams or in a team and in a personal account simultaneously, only the last account on which you have authenticated have its session file kept in the temporary folder.

I guess this is related to the fact that the op doesn't seem to handle multi accounts at the same time.

That would be great if we could use multiple accounts simultaneously and choosing the one on which we want to interact by adding a shorthand or account-email parameter.

Thanks,


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • cohix
    cohix
    1Password Alumni

    @mickael Absolutely! You can use the --account flag on any command to dictate which account gets used (the value you pass in should be the shorthand of the account that's listed in the config file). So using that you can indeed have multiple accounts active at once :)

  • mickael
    mickael
    Community Member

    Thanks @cohix, to explain the feature. Maybe you should add it to the --help argument to make it more visible?

    I also noticed that it looks like there is a session duration difference between my business account and my personal account. The file which holds the encrypted session key of my personal account is deleted before one of my business accounts.

    As I thought that the CLI didn't support multi accounts, I don't pay attention that much when and how these files are deleted.

    I will try to have a more detailed look at that and bring back further details. Unless you confirm, that the session durations are different on personal and business accounts ?

  • mickael
    mickael
    Community Member

    So, I can confirm the issue, don't know how to provide you useful debug informations.

    But so far:

    • Both sessions were open simultaneously using my oplogin script provided here
    • I have 2 OP_SESSION env variables
    • I have only one file in ${TMPDIR}/com.agilebits.op.501 the one related to my personal account
  • cohix
    cohix
    1Password Alumni

    @mickael which one did you login to first?

  • mickael
    mickael
    Community Member
    edited May 2019

    @cohix Team session first, then personal account

  • mickael
    mickael
    Community Member
    edited May 2019

    Just to add that I just discovered that the option --account is documented inside the signin command.

    You can sign in to multiple accounts this way. Commands that you run will use
    the account you signed in to most recently. To run a command using a specific
    account, use '--account=<subdomain>':
    
    op list items --account=<subdomain>
    
  • cohix
    cohix
    1Password Alumni

    @mickael hmm, the signin command does do some cleanup of old session files, but if it's only a few minutes/seconds old, then it should be left there. I'll take a look and see what's going on there.

  • mickael
    mickael
    Community Member

    :+1:

  • cohix
    cohix
    1Password Alumni

    :)

  • mickael
    mickael
    Community Member

    Just a small update, to say that my "issue" regarding session was, in fact, an issue on my own.

    I have created a small helper on my TouchBar to display if I am logged in or not in op cli.

    op get account --acount="my" > /dev/null
    MY="$?"
    op get account --account="team" > /dev/null
    TEAM="$?"
    echo "$(($MY+$TEAM))"
    

    If the result is 0, I am logged in.

    This helpers also keeps the session opened on all my accounts.

    So, I discovered that I had a typo in my team name my bad....

    Since yesterday, I have far more pleasure to use the op CLI and all the helpers I wrote around ;) No more unneeded session expiration ;)

    So, no investigations needed on that issue ;) Sorry for the false information ;)

  • Excellent! I'm glad to hear its all working well. :+1:

This discussion has been closed.