Skip to main content
August 24, 2021
Question

op signin with TOTP - powershell [beginner]

  • August 24, 2021
  • 3 replies
  • 271 views

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

3 replies

1Password Employee
August 24, 2021

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

August 25, 2021

Hi!
I am running it locally on my computer

August 27, 2021

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.