I am using sfdx to pull some data from salesforce on my desktop. Eventually I will have to put this on the server. Just wondering how long after the intial login would I have to login again? Is there a way to make the authentication last forever?



Sessions last indefinitely, by default, when using Salesforce DX. You will not need to log in again, even if you change the username or password. In order to lose your connection, you must either delete the .sfdx files that track your login details, revoke the connection in Setup > Connected App OAuth Usage, or deactivate your user account (e.g. your org is deleted, or another user deactivates your account). In other words, it's about as "forever" as you can possibly imagine, by default.

  • thanks! I have a follow up question if you don't mind. Where is this .sfdx file for windows 10? Also, can I copy this file to an Ubuntu server where I will have no way to authenticate with a web interface login? I am guessing I will need to use device login instead but unfortunately I don't have the client_id/secret from the client.
    – Chad H.
    May 27 '21 at 2:59
  • @ChadH. The files are located in %HOMEPATH%/.sfdx (Windows) or ~/.sfdx (*nix-like environments). You may or may not be able to transfer the files to a server. You may want to look into authenticating with JWT.
    – sfdcfox
    May 27 '21 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.