op signin with TOTP - powershell [beginner]

Logotrop
Logotrop
Community Member

Hi!
I am playing around with op cli to automate some login in.
I have a working automatic signin script, that retrieves all login type items and ends.
Lately I had to migrate my account to one with Mandatory 2FA (which is good), but my script can't run since there is no easy way, to input Master password and TOTP after, and sign in.

Is there an easy way, in Powershell, to have 2 Variables, $Mpass, $totp to signin and be able to get session key and work like normal?
(I can prompt for totp before command)

Snippet of the script for reference:
$Session_Token = Invoke-Expression "echo $MPass | op.exe signin domain --raw"


1Password Version: 1.11.2
Extension Version: Not Provided
OS Version: Windows 10

Comments

  • Hi @Logotrop , are you running the script on your own machine or on a server?

  • Logotrop
    Logotrop
    Community Member

    Hi!
    I am running it locally on my computer

  • Hello @Logotrop,

    Thanks for writing in! My name is Michael, and I'm one of the developers on the team responsible for the command-line tool.

    I don’t believe that it is currently possible to pass in both the password and the TOTP code via STDIN. When you pass in your password by piping the contents over STDIN, the command-line tool reads the entirety of the STDIN buffer when processing your password. There is no opportunity to also pass in TOTP code that way.

    I know that this isn’t the answer that you’d like to hear, but we’ve noted your question down as a requested feature. There are certainly times when scripting this would be ideal.

    I hope that this helps. Please feel free to write back with any additional questions you may have.

This discussion has been closed.