Skip to content

sfdx force:auth:web:login not working (also via VSCode extensions), sfdx auth:web:login is also not working #864

Closed

Description

@alanmangalindan

Summary

After running sfdx force:auth:web:login command and entering username and password, the confirmation does not appear where the CLI has successfully authorised. Instead, an OAuth error appears on the screen.

This is the same behaviour when using the VSCode Extensions using the VSCode UI.

Steps To Reproduce:

Repository to reproduce: Not applicable

NOTE: If your issue is not reproducable by dreamhouse-lwc, i.e. requires specific metadata or files, we require a link to a simple Salesforce project repository with a script to setup a scratch org that reproduces your problem.

  1. Run command: sfdx force:auth:web:login --setalias MyOrgAlias --instanceurl https://test.salesforce.com --setdefaultusername
  2. Enter Username and Password on the browser
  3. The screen waits for a response and tries to log you in
  4. Refresh browser screen and you will get an OAuth error.

Try above steps using the sfdx auth:web:login command and there are no issues.
UPDATE 2021/03/01: sfdx auth:web:login command is not working as well - tried this on a production URL https://login.salesforce.com

Expected result

SFDX via VSCode extensions will be authorised into the target org.

Actual result

OAuth error received if using the sfdx force:auth:web:login command
UPDATE 2021/03/01: sfdx auth:web:login command is not working as well - tried this on a production URL https://login.salesforce.com

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
$ sfdx --version
sfdx-cli/7.86.3 win32-x64 node-v14.15.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
$ sfdx plugins --core
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.2 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.5 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-diff 0.0.6
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.5 (core)
analytics 1.12.1 (core)
auth 1.4.7 (core)
config 1.2.4 (core)
etcopydata 0.5.7
generator 1.1.5 (core)
salesforcedx 50.16.1 (core)
├─ schema 1.0.3 (core)
├─ limits 1.0.3 (core)
├─ user 1.0.11 (core)
├─ custom-metadata 1.0.11 (core)
├─ apex 0.1.4 (core)
├─ templates 50.4.0 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
└─ salesforce-alm 50.16.1 (core)
sfdx-cli 7.86.3 (core)
sfdx-git-delta 4.2.0
telemetry 1.0.1 (core)

OS and version: Windows 10 Enterprise

Activity

  1. added
    investigating
    on Feb 22, 2021
  2. github-actions commented on Feb 22, 2021

    @github-actions

    Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

  3. changed the title [-]sfdx force:auth:web:login not working (also via VSCode extensions) but sfdx auth:web:login is[/-] [+]sfdx force:auth:web:login not working (also via VSCode extensions) but sfdx auth:web:login is working[/+] on Feb 22, 2021
  4. dhbahr commented on Feb 23, 2021

    @dhbahr

    I can also confirm the issue, downgrading to 7.26.0 solves it.

  5. torynet commented on Feb 23, 2021

    @torynet

    Same problem for multiple members of my team after updating from 7.85 to 7.88, except that no version of the command line seems to resolve it.
    Ticket in with support, but in the meantime I will attempt to downgrade. I would like to see if I can find something less drastic than 7.26.0 from a year ago. Downgrading back to 7.85 did not resolve it. Perhaps it's an issue with a dependency... Also my lone mac user updated to 7.88 and has seen no problem.

  6. AngelMtz97 commented on Feb 24, 2021

    @AngelMtz97

    I have the same issue, it keeps loading in Ubuntu

    • sfdx-cli/7.85.1-2fb9e41053 linux-x64 node-v12.18.3

    • Visual Code:

    Version: 1.53.2
    Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
    Date: 2021-02-11T11:48:44.518Z
    Electron: 11.2.1
    Chrome: 87.0.4280.141
    Node.js: 12.18.3
    V8: 8.7.220.31-electron.0
    OS: Linux x64 5.4.0-66-generic snap

  7. torynet commented on Feb 24, 2021

    @torynet

    hmm... No level of downgrading or even fully uninstalling and reinstalling an older version from NPM has been able to change the behavior for us.

    Frankly the "downgrade" procedure I read didn't seem to work. Telling it to install the plugin of a particular version would seem to work, but then if you did "sfdx -v" it would still just say 7.88.4.

  8. dhbahr commented on Feb 24, 2021

    @dhbahr

    No level of downgrading or even fully uninstalling and reinstalling an older version from NPM has been able to change the behavior for us.

    Really? Not even the oldy but goody 7.26.3? Truth be told I did not put too much effort on finding the most recent working version, but 7.26.3 really came through for me.

    Also my lone mac user updated to 7.88 and has seen no problem.

    Yeah, my mac user colleagues also don't seem to be affected.

    I can also confirm that 7.88.4 does not solve it for me.

    $ sfdx --version
    sfdx-cli/7.88.4 linux-x64 node-v15.9.0
    
    $ sfdx plugins --core
    @oclif/plugin-autocomplete 0.3.0 (core)
    @oclif/plugin-commands 1.3.0 (core)
    @oclif/plugin-not-found 1.2.4 (core)
    @oclif/plugin-plugins 1.9.5 (core)
    @oclif/plugin-warn-if-update-available 1.7.0 (core)
    @oclif/plugin-which 1.0.3 (core)
    @salesforce/lwc-dev-server 2.10.0
    ├─ @oclif/plugin-help 2.2.3
    └─ @oclif/plugin-update 1.3.9
    @salesforce/sfdx-diff 0.0.6
    @salesforce/sfdx-trust 3.6.0 (core)
    alias 1.1.7 (core)
    auth 1.4.8 (core)
    config 1.2.5 (core)
    dependencies-cli 2.0.1
    generator 1.1.5 (core)
    salesforcedx 51.0.4 (core)
    ├─ limits 1.0.4 (core)
    ├─ schema 1.0.4 (core)
    ├─ user 1.1.2 (core)
    ├─ custom-metadata 1.0.11 (core)
    ├─ apex 0.1.4 (core)
    ├─ templates 51.2.0 (core)
    ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
    └─ salesforce-alm 51.0.2 (core)
    sfdx-cli 7.88.4 (core)
    telemetry 1.1.1 (core)
    

    Also, I just realized the original reporter claims the cli does work for him, I just want to state for the record: it does not for me. I don't believe this to be related to VSCode at all, but to sfdx-cli itself.

  9. dhbahr commented on Feb 24, 2021

    @dhbahr

    hmm... No level of downgrading or even fully uninstalling and reinstalling an older version from NPM has been able to change the behavior for us.

    Frankly the "downgrade" procedure I read didn't seem to work. Telling it to install the plugin of a particular version would seem to work, but then if you did "sfdx -v" it would still just say 7.88.4.

    BTW, as per forcedotcom/salesforcedx-vscode#2931 (comment) maybe try downgrading the salesforcedx plugin directly.

  10. torynet commented on Feb 25, 2021

    @torynet

    Really? Not even the oldy but goody 7.26.3? Truth be told I did not put too much effort on finding the most recent working version, but 7.26.3 really came through for me.

    @dhbahr Well, we have had some other troubles with various versions that I didn't want to re-experience, so I was loathe to go back too far. Now that you mention it though, I don't think that I actually tested 7.26.3, because I thought it was downgrading when it was not. I'll try it over again using NPM to downgrade when I can.
    I did uninstall completely and install 7.85.1 (which is where I was before the update that caused the failure) from NPM in order to get the version I wanted. It did not seem to improve things at all.

    Still happening now:

    We can't authorize you because of an OAuth error. For more information, contact your Salesforce administrator.
    OAUTH_APPROVAL_ERROR_GENERIC : An unexpected error has occured during authentication. Please try again.
    

    Hoping to eventually hear something helpful from support.

    Since we're sharing:

    sfdx -v
     »   Warning: sfdx-cli update available from 7.85.1 to 7.88.4.
    sfdx-cli/7.85.1 win32-x64 node-v12.18.2
    
    sfdx plugins --core
     »   Warning: sfdx-cli update available from 7.85.1 to 7.88.4.
    @oclif/plugin-autocomplete 0.1.5 (core)
    @oclif/plugin-commands 1.3.0 (core)
    @oclif/plugin-help 3.2.2 (core)
    @oclif/plugin-not-found 1.2.4 (core)
    @oclif/plugin-plugins 1.9.5 (core)
    @oclif/plugin-update 1.3.10 (core)
    @oclif/plugin-warn-if-update-available 1.7.0 (core)
    @oclif/plugin-which 1.0.3 (core)
    @salesforce/sfdx-trust 3.6.0 (core)
    alias 1.1.5 (core)
    analytics 1.12.1 (core)
    auth 1.4.6 (core)
    config 1.2.3 (core)
    generator 1.1.5 (core)
    salesforcedx 50.15.0 (core)
    ├─ limits 1.0.3 (core)
    ├─ schema 1.0.3 (core)
    ├─ user 1.0.9 (core)
    ├─ apex 0.1.4 (core)
    ├─ custom-metadata 1.0.11 (core)
    ├─ templates 50.4.0 (core)
    ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
    └─ salesforce-alm 50.15.0 (core)
    sfdx-cli 7.85.1 (core)
    texei-sfdx-plugin 1.9.3
    
  11. torynet commented on Feb 25, 2021

    @torynet

    No such luck. Downgraded to 7.26.0 (that's all that was available for 7.26 on NPM), but still the very same result.

  12. dhbahr commented on Feb 25, 2021

    @dhbahr

    Hey @torynet a couple of remarks:

    First, we seemingly have different issues. In my case I don't get any oauth errors, the orgs simply don't receive a response from the localhost server listening on 1717. That being said, downgrading the salesforcedx plugin to 50.1.0 (sfdx plugins:install [email protected]) took care of my issue, without downgrading the sfdx-cli at all, maybe something worth trying?

    Also I saw now you are using node 12, could you try upgrading to 14?

    Best

  13. kresho commented on Feb 25, 2021

    @kresho

    Same issue for me.
    Ubuntu 20.10 Linux 5.10.2-surface, sfdx 7.82.1-0
    The browser redirect to localhost never completes. With trace debugging the last message i get in the log is:
    socket connection initialized from 127.0.0.1
    repeated a few times but never does anything.

    Downgrading to 7.26 worked.

  14. dhbahr commented on Feb 25, 2021

    @dhbahr

    Not to tell you what to do or anything, but I feel downgrading the salesforcedx plugin is a better approach, leaves you less outdated, @kresho .

  15. torynet commented on Feb 25, 2021

    @torynet

    @dhbahr We got the same "localhost never responds / white screen forever" sort of response initially, prior to downgrading, but while it's doing that if you refresh the page, you will then get an oauth error.
    Since downgrading it seems to skip that phase and go right to the oauth error.

    I'll reinstall up to current again and see if I can get it to downgrade the plugin. Hopefully that will do something now.

    I suppose I can upgrade node... I didn't pay attention to that. I told just told NPM to update. I'll try that as well though.

    Thanks for the advice.

  16. dhbahr commented on Feb 25, 2021

    @dhbahr

    @torynet yeah, as I mentioned a couple of comments ago, it strikes me we are experiencing 2 different bugs (albeit having the same negative impact). Hope reinstalling works for you.

  17. changed the title [-]sfdx force:auth:web:login not working (also via VSCode extensions) but sfdx auth:web:login is working[/-] [+]sfdx force:auth:web:login not working (also via VSCode extensions), sfdx auth:web:login is also not working[/+] on Feb 28, 2021
  18. alanmangalindan commented on Feb 28, 2021

    @alanmangalindan
    Author

    this worked for me:
    downgrade sfdx-cli: npm install [email protected] --global
    downgrade salesforcedx plugin: sfdx plugins:install [email protected]
    downgrade auth plugin: sfdx plugins:install [email protected]

  19. torynet commented on Mar 1, 2021

    @torynet

    @alanmangalindan I was really hopeful that your very precise procedure would work for me. Thanks for posting it.
    Unfortunately, it did not. No change.

    sfdx -v
    » Warning: sfdx-cli update available from 7.86.3 to 7.88.4.
    sfdx-cli/7.86.3 win32-x64 node-v14.16.0

    sfdx plugins --core
    » Warning: sfdx-cli update available from 7.86.3 to 7.88.4.
    @oclif/plugin-autocomplete 0.1.5 (core)
    @oclif/plugin-commands 1.3.0 (core)
    @oclif/plugin-help 3.2.2 (core)
    @oclif/plugin-not-found 1.2.4 (core)
    @oclif/plugin-plugins 1.10.0 (core)
    @oclif/plugin-update 1.3.10 (core)
    @oclif/plugin-warn-if-update-available 1.7.0 (core)
    @oclif/plugin-which 1.0.3 (core)
    @salesforce/analytics 0.23.0
    @salesforce/sfdx-trust 3.6.0 (core)
    alias 1.1.5 (core)
    analytics 1.12.1 (core)
    auth 1.4.7 (1.4.7)
    config 1.2.4 (core)
    generator 1.1.5 (core)
    mo-dx-plugin 0.3.2
    salesforcedx 50.13.1 (50.13.1)
    ├─ user 1.0.4
    ├─ schema 1.0.3
    ├─ limits 1.0.2
    ├─ salesforce-alm 50.13.1
    ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7
    ├─ templates 50.4.0
    ├─ custom-metadata 1.0.11
    └─ apex 0.1.4
    sfdx-cli 7.86.3 (core)
    telemetry 1.0.1 (core)
    texei-sfdx-plugin 1.9.3

    @dhbahr No, I'm fairly certain we are experiencing the same bug. I'm just seeing some slightly different behavior at various times, based on changes I have made to try and troubleshoot. If I take everything back to the latest and "greatest", revoke my oauth connected app user, and try again, I see the same problems as I originally did, which are exactly as you describe.

    We do seem to have some differences though, because the things that are working for you all, are not for me.

  20. dhbahr commented on Mar 1, 2021

    @dhbahr

    @dhbahr No, I'm fairly certain we are experiencing the same bug. I'm just seeing some slightly different behavior at various times, based on changes I have made to try and troubleshoot. If I take everything back to the latest and "greatest", revoke my oauth connected app user, and try again, I see the same problems as I originally did, which are exactly as you describe.

    I see, a pain in the a**e no doubt.

  21. dhbahr commented on Mar 1, 2021

    @dhbahr

    I can also confirm the newest 7.89.2 release still presents the same issue for me.

  22. alanmangalindan commented on Mar 2, 2021

    @alanmangalindan
    Author

    This is really a bit unfortunate as authorising an org should be the easy part in using dx.

    Maybe a couple of other options would be to try out other previous stable versions like 7.82.1, or to use the sfdx auth:jwt:grant command, which I haven’t encountered a problem with. But that means going through the pain of setting up a connected app and generating a certificate, like what a cicd set up will use.

  23. alanmangalindan commented on Mar 10, 2021

    @alanmangalindan
    Author

    Seems to be working already with the latest sfdx cli release 51.2.2 (March 4, 2021) - CLI 7.90.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigating

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions