Forum Discussion

demozluri's avatar
demozluri
New Contributor
10 months ago

Unable to Escape % Character in Passwords Using 1Password CLI

I'm encountering an issue with the 1Password CLI when using passwords that contain the % character. While I’ve successfully managed to escape other special characters, the % symbol is causing issues, and the password isn't accepted correctly in CLI commands. I’ve attempted multiple escape methods (e.g., //%, "%", etc.), but none have worked.

Could you provide guidance on how to handle the % character specifically in passwords when using the 1Password CLI? Any tips or workarounds would be appreciated.

Iam sharing the code snippet also here

const shell = require('shelljs');
let email = 'demo.accounts@zluri.com';
let password = '****************';
let secret = '*************************';
let address = 'team-zluridemo.1password.com';
email = email.split('$').join('\\$');
password = password.split('$').join('\\$');
secret = secret.split('$').join('\\$');
address = address.split('$').join('\\$');
email = email.split('%').join('%');
password = password.split('%').join('%');
secret = secret.split('%').join('%');
address = address.split('%').join('%');
try {
const child = shell.exec(
src/integrations/1Password/1PasswordAPI.sh ${address} ${email} ${secret} ${password},
);
if (child.stderr) {
console.log('error', child.stderr);
}
} catch (err) {
console.log(err);
}

`#!/bin/sh
export OP_DEVICE=$(head -c 16 /dev/urandom | base32 | tr -d = | tr '[:upper:]' '[:lower:]')
clientAddress=$1
clientEmail=$2
secertKey=$3
password=$4

eval $(printf $password | op account add --address $clientAddress --email $clientEmail --secret-key $secertKey --signin)
echo $(op user list --format json )

op signout --forget`


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided

No RepliesBe the first to reply