1

I'm still using the sfdx CLI, haven't upgraded to the sf one yet but maybe it's the same for both.

I see in my home directory a folder .sfdx that contains json files including one for each org I've configured. Then I see the alias.json file that looks like a map from each alias to each org file.

Does anyone know if these files are postable? By that I mean, that I've configured a number of orgs on my workstation. Now I want to access some of them on a host where I run builds. Can I copy simply copy the .json files to the user's directory on that host?

2 Answers 2

0

That won't work. The sessions stored in the configuration files are bound to that workstation/device. This is a security feature designed to prevent unauthorized access. Instead, you can arrange a JWT authentication setup so that access can be shared across multiple devices. This is the mechanism that's used for continuous integration as well.

1
  • I did read on this blog -- medium.com/@csaramagaio/… That after authenticating, you can export the connect info and then import it on another host using some commands. sfdx force:org:display --verbose --json > authfile.json // Copy the sfdxAuthURL in the json file to file sfdxAuthUrl.txt sfdx auth:sfdxurl:store -f sfdxAuthUrl.txt -s Commented May 10, 2024 at 16:14
0

You can port them, although not directly in the way of copy/pasting. Here's what you do:

Grab the Sfdx Auth Url on the computer that you have the org authenticated:

sf org display -o yourExistingOrgAlias --verbose 

enter image description here

The --verbose flag is important, as without it, the auth url wouldn't be displayed in the command output.

Now save that Auth URL in a text file on the target computer, where you want to authenticate the same org. The sf org login command has another command switch, which allows you to authenticate via an Sfdx Auth URL, instead of using a web-login:

sf org login sfdx-url --sfdx-url-file ./myOrgAuthUrl.txt --alias yourExistingOrgAlias 

This will create a separate json file on your target computer with its own session information, bound to that computer only.

Hope that helps.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.