Pass OTP during login? (Powershell)


Is it possible to pass the OTP to OP when signing into 1Password? I am attempting to automate our interactions with 1Password but wont be able to keep the session open and I am required to have 2FA enabled on my application account. I am able to pipe the password like so:

Invoke-Command -Scriptblock {$pass | ./op signin example [email protected] $secret}

Where $pass is the password value, but no matter how I try to pass a second value through, the command immediately throws the following error on displaying the prompt:

Enter your six-digit authentication code: [LOG] 2019/08/05 22:49:03 (ERROR) Incorrect One-Time Password length. Expected 6.

I've done some google-fu and found a forum where the users where having the problem using BASH and resorted to using the Expect command, but there is no Powershell equivalent. I just wanted to check whether this was expected behaviour before I go about recoding and replatforming :)


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


  • graham_1Pgraham_1P

    Team Member

    Hey @ptype85,

    The OTP is consumed in a similar way to the password. How are you trying to pass in the second value? It should be the second prompt to type something in, right after the password.

    Also, as a non-Powershell user, can I assume Invoke-Command -Scriptblock[...] runs whatever is in the square brackets in a shell environment?


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file