Last active
November 2, 2018 16:01
-
-
Save tommorris/a6adca9bfa3818492861afb1789e73c4 to your computer and use it in GitHub Desktop.
An example of how to retrieve API keys from 1Password vault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval $(op signin <yoursubdomain>) # this will prompt you to log in | |
export NEXMO_API_KEY=$(op get item Nexmo | jq '.details.sections[]? | select(.fields) | .fields[] | select(.t == "key").v') | |
export NEXMO_API_SECRET=$(op get item Nexmo | jq '.details.sections[]? | select(.fields) | .fields[] | select(.t == "secret").v') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need a 1Password entry like this with your API key/secret stored in it.
You also need
op
(the 1Password CLI) set up, as well asjq
. You may need to mess around with thejq
selectors depending on how your API key/secret are stored.The script above: pop it in a bash script, make sure it is in your path. When you call it, it'll ask you for your 1P passphrase and then set environment variables as appropriate from your vault. If you've got multiple credentials for a particular service, you should give them nice distinctive names.