How can I update or create with OP a Login?
I try to store login information via a bash file. How can I create or update login information in an vault?
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided
Referrer: forum-search:How can I update or create with OP a Login?
Comments
-
@hayo we currently do not support updating items with
op
, but here are the instructions to create an item: https://support.1password.com/command-line/#create-an-item0 -
Hi cohix,
thanks. For anyone who is looking here a short script:delete for existing login
uuid=$(op get item "${LOGIN_TITLE}" --vault="${VAULT_NAME}" | jq '(.uuid)' | sed 's/\"//g')
if [ -n "$uuid" ]
then
op delete item $uuid
ficreate new login information
login=$( op get template login )
login_user=$( echo $login | jq --arg USER "$USER" -c '.fields[0].value = $USER ')
login_user_pw=$( echo $login_user | jq --arg PW "$PW" -c '.fields[1].value = $PW' )
encoded_login=$( echo $login_user_pw | op encode )save in vault
op create item Login $encoded_login --title="$LOGIN_TITLE" --vault="$VAULT_NAME"
echo '1Password Login updated for '${USER}'0 -
Thank you for sharing this! :+1:
0 -
As of v0.10.0, the 1Password command line tool has a
edit item
command with which existing fields of an item can be updated. See https://support.1password.com/command-line-reference/#edit-item for more information!0