chrome-cookies-secure
chrome-cookies-secure copied to clipboard
Error running through SSH
chrome-cookies-secure is very helpful ;-) thanks for that
The following code works just fine on MacOS:
const chrome = require('chrome-cookies-secure');
chrome.getCookies('https://www.google.com/', function(err, cookies) {
console.log(cookies);
});
but running it through SSH I get the following error:
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: User interaction is not allowed.]
Node.js v19.2.0
Keychain access to "Chrome Safe Storage" is set to "Allow all applications to access this item"
Any idea?
Are you SSH'ing to another macOS server? What command are you using to trigger the script? I've not run it like this before.
I solved the problem hardcoding chromePassword call: crypto.pbkdf2(chromePassword, SALT, ITERATIONS, KEYLENGTH, 'sha1', callback); in '/Users/team/node_modules/chrome-cookies-secure/index.js'
You mean in the getDerivedKey function there's a case that wasn't handled by the if / else blocks?
It already runs pbkdf2 as you describe it in the darwin & linux cases:
https://github.com/bertrandom/chrome-cookies-secure/blob/master/index.js#L52
So are you saying there's platform value that isn't getting picked up?
Or are you hard-coding the chromePassword value itself in one of the if blocks?
Hi Ruben,
Yes, I hardcode the chromePassword.
if (process.platform === 'darwin') {
keytar = require('keytar');
keytar.getPassword('Chrome Safe Storage', 'Chrome').then(function(chromePassword) {
//crypto.pbkdf2(chromePassword, SALT, ITERATIONS, KEYLENGTH, 'sha1', callback);
crypto.pbkdf2('hxC47gOiK9i2f+Olwdaonw==', SALT, ITERATIONS, KEYLENGTH, 'sha1', callback);
});
}
Where did you get the password from? Is this from your keychain?
Yes
Le ven. 29 sept. 2023 à 19:16, Reece Daniels @.***> a écrit :
Where did you get the password from? Is this from your keychain?
— Reply to this email directly, view it on GitHub https://github.com/bertrandom/chrome-cookies-secure/issues/51#issuecomment-1741241811, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANQXEA6GJT36FCNLTKRC27DX4366RANCNFSM6AAAAAAWG3ETLA . You are receiving this because you authored the thread.Message ID: @.***>