How can I script the op signin via a node application?

edited June 4 in CLI

I'm working on some node scripts/apps that will simplify my life on multiple platforms when using the op CLI and have a question on stack overflow which I'd love for someone to take a look at and provide some feedback if possible: https://stackoverflow.com/q/56438183/1165441


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

Comments

  • graham_1Pgraham_1P

    Team Member

    Hey @eddiehedges

    We don't provide support on Stack Overflow; this forum is for 1Password support.

    Feel free to ask a question here for support, but note we cannot provide debugging assistance on your node app. We can answer questions on and around the CLI, such as how it receives and outputs data.

  • I'm simply using node to invoke an op command and am running into an error when the password prompt appears. Since the CLI is not open source and I haven't attempted to decompile/figure out how to access the source is there some information that you'd be able to provide to me so that I may continue in my efforts of scripting the signin process? Are there alternatives that take the master password as an argument or is this a feature that could be added? Or even more generally how does that prompt receive and output data?

  • graham_1Pgraham_1P

    Team Member

    @eddiehedges

    Here is the full CLI command documentation: https://support.1password.com/command-line/

    You can pass a signin domain, email, and secret key like so op signin <signinaddress> <emailaddress> <secretkey>.

    Putting a master password in a script or as an argument is something we strongly recommend against; it should only be in your head, never written down beyond on your recovery kit.

    The signin password prompt is set up to read from stdin or from /dev/tty.

  • Any idea as to why it's crashing the child_process spawn call? I can't even get the script to accept stdin since it crashes before that.

  • @eddiehedges I had some issues to launch the op cli in python as well. If I compare with what I did, try to spawn the command in a shell and pass the full environment.

  • Thanks @mickael I'll give that a shot.

  • cohixcohix

    Team Member

    Let us know how it goes!

Leave a Comment

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