Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
Former Member
3 years agoLocal NodeJS script - use item from 1password personal vault
How can I use an item stored in 1Password personal vault from NodeJS script running locally? I see connect-sdk-js requires "1Password Connect API hosted on your infrastructure". Is it possible to do ...
Jack_P_1P
1Password Team
3 years agoHi @vineet1passwd:
Great question! If you're looking to run your Node.js program locally, what may work best for you is the run
command in 1Password CLI.
run | 1Password CLI
Using this, it would be possible to set an environment variable (either in your shell, or using the .env
file) to a secret reference, like: op://vault/item/field
. Next, use 1Password CLI to run the command: op run -- node main.js
. 1Password CLI will process the environment variables and replace the secret reference in the environment variable with the value of the secret. At that point, you can use standard Node.js functions to get the value of the environment variable, which now contains the environment variable.
Let me know if that helps, or if you'd like me to dig in a bit further with you!
Jack