X
Tap here to go to the mobile version of the site.

Support Forum

How do I export "saved logons"?

Posted

Between two Win10 Home PCs, both used to have all my Saved Logons, but somehow one PC has dropped them all. Both PCs do use Firefox Sync between successfully, but while that synchronizes Bookmarks (& whatever else), evidently NOT "Saved Logons". So, isn't there some way to EXPORT all of them to a file, to then IMPORT them to my other PC? Incidentally, within Saved Logons, there is a button named IMPORT, but it's used is only for importing from 3 other designated browsers, and apparently on the self-same PC. Searching Firefox Support was a waste of time ... their 'results' are just wide nets of hundreds of irrelevant things, no matter how precise I attempt each search. Bad support job on self-help, Mozilla.

Between two Win10 Home PCs, both used to have all my Saved Logons, but somehow one PC has dropped them all. Both PCs do use Firefox Sync between successfully, but while that synchronizes Bookmarks (& whatever else), evidently NOT "Saved Logons". So, isn't there some way to EXPORT all of them to a file, to then IMPORT them to my other PC? Incidentally, within Saved Logons, there is a button named IMPORT, but it's used is only for importing from 3 other designated browsers, and apparently on the self-same PC. Searching Firefox Support was a waste of time ... their 'results' are just wide nets of hundreds of irrelevant things, no matter how precise I attempt each search. Bad support job on self-help, Mozilla.

Chosen solution

https://www.ghacks.net/2018/07/18/how-to-export-firefox-passwords-in-firefox-57/ ++++++++++++++++++++++++++++++++++++ http://www.nirsoft.net/utils/passwordfox.html (Win) PasswordFox v1.58 - Extract the usernames/passwords stored in Firefox Copyright (c) 2008 - 2017 Nir Sofer

Note: Some anti-virus show false positive. ++++++++++++++++++++++++++++++++++ Easily export your passwords from Firefox. https://github.com/kspearrin/ff-password-exporter

Export your passwords from Firefox in a portable CSV or JSON format. It works on Windows, macOS, and Linux. +++++++++++++++++++++++++++++++++++ 3 Tools to Decrypt and Recover Passwords Saved in Firefox • Raymond CC https://www.raymond.cc/blog/how-to-find-hidden-passwords-in-firefox/ +++++++++++++++++++++++++++++++++++ https://www.ghacks.net/2018/07/18/how-to-export-firefox-passwords-in-firefox-57/ ++++++++++++++++++++++++++++++++++++ https://github.com/kspearrin/ff-password-exporter

Read this answer in context 1

Additional System Details

Installed Plug-ins

  • Shockwave Flash 32.0 r0

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0

More Information

jscher2000
  • Top 10 Contributor
8837 solutions 72222 answers

Helpful Reply

Actually, there is no feature to export/import saved logins, so the fact that you didn't find an answer has a good basis.

Sync should work if logins are a selected category. However, before changing any Sync settings, I suggest making a backup of your profile, where Firefox stores your browser data. I'll give a link to an article on that further below.

One option to transfer your saved logins would be to copy a pair (or trio) of files from one PC to the other. Those files are:

  • logins.json
  • key4.db
  • key3.db (legacy file, may not be needed)

Those files are stored in your currently active Firefox profile folder. These articles describe how to find that folder and what it contains. On the receiving Firefox, you'll want to exit out before replacing in-use files.

References:

Actually, there is no feature to export/import saved logins, so the fact that you didn't find an answer has a good basis. Sync should work if logins are a selected category. However, before changing any Sync settings, I suggest making a backup of your profile, where Firefox stores your browser data. I'll give a link to an article on that further below. One option to transfer your saved logins would be to copy a pair (or trio) of files from one PC to the other. Those files are: * logins.json * key4.db * key3.db (legacy file, may not be needed) Those files are stored in your currently active Firefox profile folder. These articles describe how to find that folder and what it contains. On the receiving Firefox, you'll want to exit out before replacing in-use files. ''References:'' * [[Profiles - Where Firefox stores your bookmarks, passwords and other user data]] * [[Back up and restore information in Firefox profiles]] * [[Recovering important data from an old profile]] * https://support.microsoft.com/en-us/help/14201/windows-show-hidden-files
FredMcD
  • Top 10 Contributor
4308 solutions 60487 answers

Chosen Solution

https://www.ghacks.net/2018/07/18/how-to-export-firefox-passwords-in-firefox-57/ ++++++++++++++++++++++++++++++++++++ http://www.nirsoft.net/utils/passwordfox.html (Win) PasswordFox v1.58 - Extract the usernames/passwords stored in Firefox Copyright (c) 2008 - 2017 Nir Sofer

Note: Some anti-virus show false positive. ++++++++++++++++++++++++++++++++++ Easily export your passwords from Firefox. https://github.com/kspearrin/ff-password-exporter

Export your passwords from Firefox in a portable CSV or JSON format. It works on Windows, macOS, and Linux. +++++++++++++++++++++++++++++++++++ 3 Tools to Decrypt and Recover Passwords Saved in Firefox • Raymond CC https://www.raymond.cc/blog/how-to-find-hidden-passwords-in-firefox/ +++++++++++++++++++++++++++++++++++ https://www.ghacks.net/2018/07/18/how-to-export-firefox-passwords-in-firefox-57/ ++++++++++++++++++++++++++++++++++++ https://github.com/kspearrin/ff-password-exporter

https://www.ghacks.net/2018/07/18/how-to-export-firefox-passwords-in-firefox-57/ ++++++++++++++++++++++++++++++++++++ http://www.nirsoft.net/utils/passwordfox.html (Win) PasswordFox v1.58 - Extract the usernames/passwords stored in Firefox Copyright (c) 2008 - 2017 Nir Sofer Note: Some anti-virus show false positive. ++++++++++++++++++++++++++++++++++ Easily export your passwords from Firefox. https://github.com/kspearrin/ff-password-exporter Export your passwords from Firefox in a portable CSV or JSON format. It works on Windows, macOS, and Linux. +++++++++++++++++++++++++++++++++++ 3 Tools to Decrypt and Recover Passwords Saved in Firefox • Raymond CC https://www.raymond.cc/blog/how-to-find-hidden-passwords-in-firefox/ +++++++++++++++++++++++++++++++++++ https://www.ghacks.net/2018/07/18/how-to-export-firefox-passwords-in-firefox-57/ ++++++++++++++++++++++++++++++++++++ https://github.com/kspearrin/ff-password-exporter
cor-el
  • Top 10 Contributor
  • Moderator
17687 solutions 159999 answers

Note that in Firefox 67-69 you can possibly use the Firefox Lockwise (formerly named Lockbox) extension to share passwords via a Firefox Sync account (2.2.0 is for 67+, older 2.1.0 for 63+).

Note that in Firefox 70 and later Lockwise is a builtin component and can also be used to add a new username and password.


Note that you can use code in the Browser Console to export and import passwords.

See these replies for possible alternatives using the Browser Console to run JavaScript code.


Code for Firefox 52+:

/* EXPORT to firefox-logins.json - Firefox 52 and later */

async function exportLogins (aPath, bytes){
 await OS.File.writeAtomic(aPath, bytes);
}

var tokendb = Cc["@mozilla.org/security/pk11tokendb;1"].createInstance(Ci.nsIPK11TokenDB);
var token = tokendb.getInternalKeyToken();

try {token.login(true)} catch(e) {Cu.reportError(e)}

if (!token.needsLogin() || token.isLoggedIn()) {
 var logins = Services.logins.getAllLogins({});
 var json = JSON.stringify(logins, null, 1);

 var ps = Services.prompt;
 var txt = 'Logins: ' + logins.length;
 var obj = new Object; obj.value = json;

 if (ps.prompt(null, 'Logins - JSON', txt, obj, null, {})){
 var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
 fp.init(window,"",Ci.nsIFilePicker.modeSave);
 fp.defaultString = "firefox-logins.json";

 fp.open((rv) => {
 if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) {
 let bytes = new TextEncoder().encode(json);
 exportLogins(fp.file.path, bytes);
 }})
} else {console.log("<canceled>");} }

/* IMPORT from JSON file - Firefox 52 and later */

async function importLogins(aPath){ /*[52+]*/
let bytes = await OS.File.read(aPath);
let logins = JSON.parse(new TextDecoder().decode(bytes));
ImportLogins(logins);
}

function ImportLogins (logins){ /*[42+]*/
try { /*[60+]*/
 ChromeUtils.import("resource://gre/modules/LoginHelper.jsm");
 LoginHelper.maybeImportLogins(logins);
} catch(e) {/*[42-59]*/
 Cu.import("resource://gre/modules/LoginHelper.jsm");
 for (i in logins) LoginHelper.maybeImportLogin(logins[i]);
}
}

var fu = Cu.import("resource://gre/modules/FileUtils.jsm").FileUtils;
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);

fp.init(window, "Open File", Ci.nsIFilePicker.modeOpen);
fp.appendFilter(".json JSON Files","*.json");

fp.open((aResult) => {
  if (aResult == Ci.nsIFilePicker.returnOK) {
  if (fp.file.exists() && fp.file.isFile() && fp.file.isReadable()) {
    var loginsfile = fp.file.path;
    try {
     importLogins(loginsfile);
     console.log("<async import>");
    }
    catch (err) {console.log(err);}
  }
  } else {console.log("<canceled>");}
})
Note that in Firefox 67-69 you can possibly use the Firefox Lockwise (formerly named Lockbox) extension to share passwords via a Firefox Sync account (2.2.0 is for 67+, older 2.1.0 for 63+). *https://github.com/mozilla-lockwise/lockwise-addon/releases/ *https://mozilla-lockwise.github.io/faq.html Note that in Firefox 70 and later Lockwise is a builtin component and can also be used to add a new username and password. ---- Note that you can use code in the Browser Console to export and import passwords. *https://developer.mozilla.org/en-US/Tools/Browser_Console See these replies for possible alternatives using the Browser Console to run JavaScript code. *[[/questions/1239821#answer-1171958]] Will Saved Password Editor ever work again? *[[/questions/1195733#answer-1053091]] Is it possible to export the saved passwords to HTML? *[[/questions/1077630#answer-834769]] How can I "print" the saved passwords list? ---- Code for Firefox 52+: <pre><nowiki> /* EXPORT to firefox-logins.json - Firefox 52 and later */ async function exportLogins (aPath, bytes){ await OS.File.writeAtomic(aPath, bytes); } var tokendb = Cc["@mozilla.org/security/pk11tokendb;1"].createInstance(Ci.nsIPK11TokenDB); var token = tokendb.getInternalKeyToken(); try {token.login(true)} catch(e) {Cu.reportError(e)} if (!token.needsLogin() || token.isLoggedIn()) { var logins = Services.logins.getAllLogins({}); var json = JSON.stringify(logins, null, 1); var ps = Services.prompt; var txt = 'Logins: ' + logins.length; var obj = new Object; obj.value = json; if (ps.prompt(null, 'Logins - JSON', txt, obj, null, {})){ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window,"",Ci.nsIFilePicker.modeSave); fp.defaultString = "firefox-logins.json"; fp.open((rv) => { if (rv == Ci.nsIFilePicker.returnOK || rv == Ci.nsIFilePicker.returnReplace) { let bytes = new TextEncoder().encode(json); exportLogins(fp.file.path, bytes); }}) } else {console.log("<canceled>");} } </nowiki></pre> ---- <pre><nowiki> /* IMPORT from JSON file - Firefox 52 and later */ async function importLogins(aPath){ /*[52+]*/ let bytes = await OS.File.read(aPath); let logins = JSON.parse(new TextDecoder().decode(bytes)); ImportLogins(logins); } function ImportLogins (logins){ /*[42+]*/ try { /*[60+]*/ ChromeUtils.import("resource://gre/modules/LoginHelper.jsm"); LoginHelper.maybeImportLogins(logins); } catch(e) {/*[42-59]*/ Cu.import("resource://gre/modules/LoginHelper.jsm"); for (i in logins) LoginHelper.maybeImportLogin(logins[i]); } } var fu = Cu.import("resource://gre/modules/FileUtils.jsm").FileUtils; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init(window, "Open File", Ci.nsIFilePicker.modeOpen); fp.appendFilter(".json JSON Files","*.json"); fp.open((aResult) => { if (aResult == Ci.nsIFilePicker.returnOK) { if (fp.file.exists() && fp.file.isFile() && fp.file.isReadable()) { var loginsfile = fp.file.path; try { importLogins(loginsfile); console.log("<async import>"); } catch (err) {console.log(err);} } } else {console.log("<canceled>");} }) </nowiki></pre>

Modified by cor-el