sfdx-actions / setup-sfdx

Salesforce SFDX CLI GitHub Action
MIT License
81 stars 28 forks source link

Unclear how to get refresh token / force URL #10

Open fransf-wtax opened 3 years ago

fransf-wtax commented 3 years ago

The README says:

You can obtain the URL from a authorized org from your local machine using: sfdx force:org:display -u ORG-ALIAS --verbose

However, running this command on my prod org gives the following output:

{
  "username": "admin@********",
  "accessToken": "d47b6dbd7f****************************************:8f49********",
  "orgId": "00D***************",
  "loginUrl": "https://login.salesforce.com/",
  "privateKey": "******************",
  "clientId": "3H7c**************************",
  "instanceUrl": "https://****.my.salesforce.com",
  "instanceApiVersion": "52.0",
  "instanceApiVersionLastRetrieved": "9/23/2021, 10:22:37 AM"
}

I don't see any URL containing a refresh token, or the refresh token itself. Perhaps the README instructions are outdated?

BrunoMendes-Hotmart commented 2 years ago

Hi, how are you? Do you solve the problem? I have the same problem.

baksale commented 2 years ago

Hi @BrunoMendes-Hotmart @fransf-wtax , Have you authenticated your orgs using jwt flow?

If this is the case, the sfdx force:org:display command will not show auth url.

sfdx force:auth:sfdxurl:store -h | grep "only for orgs authorized with the web server flow" -A 2

You have to re-authenticate your orgs using web flow: sfdx force:auth:web:login -h

If this is the case, please comment and close the issue.

Julian88Tex commented 2 years ago

@baksale Not sure about @fransf-wtax's use case, but I'd definitely appreciate being able to get a refresh token without having to go through a JWT or web login flow.

baksale commented 2 years ago

@Julian88Tex with auth url for your org you will not need to refresh any tokens - the action will just work.

Below operations needs to be done for THE_ORG just once:

  1. Authorize THE_ORG via web flow
  2. get the auth url once for your org via sfdx force:org:display -u THE_ORG --verbose --json
  3. Use the auth url for the action

It will work THE_ORG going further.

The issue guys mentioned earlier most likely due to THE_ORG was authorized via jwt flow.

Julian88Tex commented 2 years ago

@baksale thanks yes I realize that however I am actually trying to obtain a refresh token so that I can use it as an authentication method for some CI/CD processes