2

Is it possible to migrate/backup locally authenticated orgs to a new machine without having to re-authenticate on another machine?

After running sfdx force:auth:web:login, the authentication flow here saves a token to the machine (works its magic under the hood). Can we copy and paste wherever this is saved onto a new machine without having to re-authenticate with the Salesforce Orgs?

2 Answers 2

3

You can achieve this by copying the .sf and .sfdx folder contents in the user's home directory (which varies by OS). For Windows you will typically find these in C:\Users\username\.

Be very careful with these details since the JSON files (one per org connection) in these folders include both the access and refresh tokens and therefore can allow someone to gain access to the org without need to login.

As per comments, with the introduction of the SF CLI you also need to copy a password from your keychain.

3
  • This seems to no longer works today, I get this error "authdecrypterror"
    – Theodoor
    Commented Mar 30 at 19:15
  • 1
    There is now a .sf folder if you are using up-to-date CLI.
    – Phil W
    Commented Mar 30 at 19:27
  • That's true. But if you change machines, you also have to copy your password from your keychain. That's how i did do it in the "login" keychain, with key called "sfdx".
    – Theodoor
    Commented Apr 2 at 6:28
0

I just did this on a new Windows 10 machine and it worked by just copying across the .sfdx folder. I'm using v2.28.7.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .