New OAuth connections are not added to the connections list

Issue #1911 resolved
Jeff May created an issue

sfdx: 7.103.0-037481c
IC 2.1.7.9

The create new OAuth connection workflow completes successfully, but the new connection is not added to the connection list.

Comments (9)

  1. Jeff May reporter

    Scott - it just occurred to me that right now, SBoxes are on Summer 21, maybe that’s the prob. I don’t have any Spring 21 orgs I can test with

  2. Scott Wells repo owner

    That may well be the case. I'll tell you what I've found either way, though. I see the force:auth:web:login finish successfully:

    /usr/local/bin/sfdx force:auth:web:login -a hw-new2e2 -r https://test.salesforce.com/ --json
    
    {
      "status": 0,
      "result": {
        "username": "jeff.may@olooptech.com.fsle2e",
        "accessToken": "<redacted>",
        "instanceUrl": "https://nex--hbtfsle2e.my.salesforce.com",
        "orgId": "00D6s0000004dMuEAI",
        "loginUrl": "https://test.salesforce.com/",
        "refreshToken": "<redacted>",
        "clientId": "PlatformCLI"
      }
    }
    

    and then when IC2 gets the latest list of orgs, the newly-authenticated org is included but with another alias:

    /usr/local/bin/sfdx force:org:list --skipconnectionstatus --json
    
    ...
          {
            "username": "jeff.may@olooptech.com.fsle2e",
            "accessToken": "<redacted>",
            "instanceUrl": "https://nex--hbtfsle2e.my.salesforce.com",
            "orgId": "00D6s0000004dMuEAI",
            "loginUrl": "https://test.salesforce.com/",
            "clientId": "PlatformCLI",
            "alias": "hw-e2e",
            "lastUsed": "2021-06-02T18:43:02.267Z"
          },
    ...
    

    Notice that you've successfully authenticated username jeff.may@olooptech.com.fsle2e with alias hw-new2e2, but that username is associated with alias hw-e2e in the force:org:list response.

    So whatever is going on here seems to be an issue with the CLI. I wonder if running sfdx force:org:list without the --skipconnectionstatus flag might correct this stale information. You can either do that from the command-line, or you can do it using the Force Refresh Salesforce CLI Connections toolbar button in the connection list (the red refresh button).

    And I guess I should have started here, but what version of the CLI do you have installed?

  3. Scott Wells repo owner

    FYI, I'm able to reproduce this behavior locally. If I have username foo@bar.com authenticated as alias baz already, then I authenticate as that user again but with alias baz2, the username is still associated with alias baz. I'll check with the CLI team and see if this is a known issue. My guess is that a viable workaround would be to remove the existing alias and reauthenticate with that username.

  4. Scott Wells repo owner

    Jeff, I'm going to resolve this as it does seem to be a problem with the CLI itself. Let's monitor progress via the linked CLI issue tracker bug, but if it comes back around as something specific to IC2, we'll reopen here.

  5. Scott Wells repo owner

    I also removed the attached idea.log just in case any of its contents might be considered sensitive (probably not). I was able to extract the relevant portions and have included them in my own response with tokens and such redacted.

  6. Log in to comment