Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDX: Authorize an Org hangs after login attempt #890

Closed
kadantsam opened this issue Mar 1, 2021 · 41 comments · Fixed by forcedotcom/sfdx-core#384
Closed

FDX: Authorize an Org hangs after login attempt #890

kadantsam opened this issue Mar 1, 2021 · 41 comments · Fixed by forcedotcom/sfdx-core#384
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@kadantsam
Copy link

All,

This all started last Wednesday, February 24 very late in the day. I have not been able to get connected to the Salesforce Sandbox since then. I have performed the sfdx update several times since and this has not helped. Can anyone help me. I have 4 LWC's that need to be published.

I am on a Windows 10 laptop with the latest patches and updates from Microsoft Version 10.0.18363. When I attempt to Authorize an Org it opens Google Chrome Version 88.0.4324.190 (Official Build) (64-bit). I login using the login I've been using successfully since yesterday, I get the prompt to Allow Access, and it just hangs. I am currently running VS Code Version: 1.53.2. I have the Salesforce Extension Pack v51.2.0, and the same for the Salesforce CLI Integration.

I'm using sfdcLoginUrl = https://test.salesforce.com

When I execute the Authorize an Org it sends me to the following URL provided I have Revoked the previous attempt: https://<my_org_name>/setup/secur/RemoteAccessAuthorizationPage.apexp?source="very long string"

I am unable to find port 1717 running using suggestions previously mentioned.
I have uninstalled VS Code twice and deleted everything the second time before re-installing.
I have switched the Default browser to Edge each time and this doesn't work. I even tried IE once!!
I look for node.js running and if I kill that process the web browser immediately throws me into the unable to open local port 1717.
I've tried sfdx auth:web:login instead of sfdx force:auth:web:login and this does not work.
After the failed attempts I Revoke the Salesforce CLI found under my login ID.
In my troubleshooting I've seen OAuth Error
I have set the Google Chrome to run in Windows 8 compatibility mode as well. This doesn't help either.
I added the C:\Windows\System32 to the PATH environment variable as well.
I also tried logging in with our Salesforce Admin credentials and that didn't work either.
What am I missing here. Can someone please advise?

Thank you.

@team-seavus
Copy link

forcedotcom/salesforcedx-vscode#2931

This helped me: sfdx plugins:install salesforcedx@48.22.11

@kadantsam
Copy link
Author

kadantsam commented Mar 1, 2021

Team-seavus,

Thank you for the reply!! This did not work for me. To re-iterate, I attempt to "Authorize an Org" and it opens up Google Chrome and prompts me if it is okay for Access and click allow then it redirects me to the following URL and just hangs:

https://{my org}.my.salesforce.com/_ui/identity/oauth/ui/AuthorizationPage

Any help is greatly appreciated.

@team-seavus
Copy link

Team-seavus,

Thank you for the reply!! This did not work for me. To re-iterate, I attempt to "Authorize an Org" and it opens up Google Chrome and prompts me if it is okay for Access and click allow then it redirects me to the following URL and just hangs:

https://{my org}.my.salesforce.com/_ui/identity/oauth/ui/AuthorizationPage

Any help is greatly appreciated.

Sorry to hear that, my problem was very similar.
Maybe you can try with different Browser or check the steps given here: forcedotcom/salesforcedx-vscode#2996 (uninstall->install).

@kadantsam
Copy link
Author

kadantsam commented Mar 1, 2021

Team-seavus,
Thank you for the reply!! This did not work for me. To re-iterate, I attempt to "Authorize an Org" and it opens up Google Chrome and prompts me if it is okay for Access and click allow then it redirects me to the following URL and just hangs:
https://{my org}.my.salesforce.com/_ui/identity/oauth/ui/AuthorizationPage
Any help is greatly appreciated.

Sorry to hear that, my problem was very similar.
Maybe you can try with different Browser or check the steps given here: forcedotcom/salesforcedx-vscode#2996 (uninstall->install).

Switched to Microsoft Edge and still no good. I've re-installed twice so far. Still NFG!!

I just looked at the link you provided and I have the same values that the user reported when he re-installed, but this still does not work:

Version: 1.53.2 (user setup)
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:48:04.245Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.18363

BTW, one more note!! Raul suggested using the following command:

// authorize production org
sfdx auth:device:login

The above worked to get me into the production server, however, when I try the following:

// authorize sandbox
sfdx auth:device:login -r https://test.salesforce.com

I get the following error:
"ERROR running auth:device:login: Value is not an string"

@ImJohnMDaniel
Copy link

Some of my team have seen similar issues. We had to downgrade to 7.83 to get stable again.

@kadantsam
Copy link
Author

Some of my team have seen similar issues. We had to downgrade to 7.83 to get stable again.

ImJohnMDaniel, thank you very much for the suggestion. I will try this next and report on the my progress.

@kadantsam
Copy link
Author

kadantsam commented Mar 1, 2021

Some of my team have seen similar issues. We had to downgrade to 7.83 to get stable again.

ImJohnMDaniel, thank you very much for the suggestion. I will try this next and report on the my progress.

ImJohnMDaniel, I'm confused, what exactly did your team downgrade to 7.83? I presumed you were talking about the Salesforce CLI. Can you please provide a little more detail? Thanks.

@ImJohnMDaniel
Copy link

All of the versions since 7.84 have been unstable in some manner. We are not bother to downgrade specific elements of the CLI as that can cause more chaos. My team saved the installation media for v7.83. We have uninstalled any version higher than that and have installed the 7.83 version. Most of the team are also using the environment variable SFDX_DISABLE_AUTOUPDATE (ref) to prevent automatic upgrades until the CLI gets stable again.

FYI @amphro @clairebianchi

@kadantsam
Copy link
Author

All of the versions since 7.84 have been unstable in some manner. We are not bother to downgrade specific elements of the CLI as that can cause more chaos. My team saved the installation media for v7.83. We have uninstalled any version higher than that and have installed the 7.83 version. Most of the team are also using the environment variable SFDX_DISABLE_AUTOUPDATE (ref) to prevent automatic upgrades until the CLI gets stable again.

FYI @amphro @clairebianchi

Thank you again for the information. I can't seem to find the version you are referencing. Do you have any idea how I can find that version?

@ImJohnMDaniel
Copy link

We saved the installed from when it was originally released. Maybe @amphro or @clairebianchi know how to access v7.83 from the public

@kadantsam
Copy link
Author

All,

Thanks to ImJohnMDaniel I've got it fixed.

  1. Go to the following URL:
    https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode
  2. Download an older version, I downloaded 50.16.0
  3. Uninstall any of the Salesforce extensions in VS Code
  4. Restart the VS Code and click on the Extensions, and the three dots at the top
  5. Then click on the Install from SVIX...
  6. And, point it to the file you just downloaded.
  7. I restarted VS Code to be on the safe side but I'm back up and running.
    Thank you everyone.

@qwikag
Copy link

qwikag commented Mar 1, 2021

@kadantsam
Sorry this did not work. (uninstall and DL the extensions)
I followed your instruction to the letter.
I uninstalled the visualforce extension (as per your instruction to uninstall any)then restarted.
and I installed the downloaded verion as advised, it did nothing.
SO I went a step further and uninstalled all Salesforce extensions and even removed the folders within my HOME folder.
I then re-added the extension, and now it just tells me it is successful but does not open the browser at all and does not connect the org.

To the developers
This problem was resolved, once upon a time, but has come back again.
PLEASE can you employ an Automated Testing regime to ensure you stop regressing code.

I had this problem in a previous version. Now it is back
I recently upgraded again due to a different issue with retrieval and deployment, and now this Auth issue is back.

@qwikag
Copy link

qwikag commented Mar 1, 2021

Updated CLI from 7.88.4-3b2e55c3f1 to 7.89.2-d1d2614d02...
NOTHING WORKS!

@qwikag
Copy link

qwikag commented Mar 2, 2021

removed cli software via WIN10 REMOVE SOFTWARE Feature
Reinstalled via Node
Same problem, does not access localhost

this is my setup:

sfdx --version
sfdx-cli/7.89.2 win32-x64 node-v14.16.0

sfdx plugins
no plugins installed

sfdx plugins --core
You acknowledge and agree that the CLI tool may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the CLI tool and product improvements.

@oclif/plugin-autocomplete 0.3.0 (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.4.0-2 (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.7 (core)
auth 1.4.9 (core)
config 1.2.5 (core)
generator 1.1.5 (core)
salesforcedx 51.1.1 (core)
├─ limits 1.0.4 (core)
├─ user 1.1.2 (core)
├─ schema 1.0.4 (core)
├─ templates 51.3.0 (core)
├─ custom-metadata 1.0.11 (core)
├─ apex 0.1.4 (core)
├─ salesforce-alm 51.1.1 (core)
└─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
sfdx-cli 7.89.2 (core)
telemetry 1.1.1 (core)

@peternhale peternhale added the bug Issue or pull request that identifies or fixes a bug label Mar 2, 2021
@uip-robot-zz
Copy link

This issue has been linked to a new work item: W-8956885

@QuinnM2
Copy link

QuinnM2 commented Mar 2, 2021

Just to tag onto this, I'm having the same issue, and following the step list that @kadantsam posted didn't fix it. I've tried re-installing salesforce CLI itself with multiple versions, as well as downgrading the VS Code package, but all still result in the hang after entering credentials.

@qwikag
Copy link

qwikag commented Mar 2, 2021

None of the solutions online worked for me.
Great that this has been picked up.
In the meantime this works:
sfdx auth:device:login -a MyAlias -r https://mydomain--sandbox.my.salesforce.com -s

@qwikag
Copy link

qwikag commented Mar 2, 2021

Guys, when you fix this please provide more detailed instructions about how this is to be installed; including things like proxies etc.
There were a lot of fixes across the internet and they all called for settings that could cause issues elsewhere, so a little more detail about device setup would be excellent.

Thank you

@RodEsp
Copy link
Contributor

RodEsp commented Mar 2, 2021

Hi @kadantsam and @qwikag, I haven't identified a fix but I believe the issue is related to having a space in the path to your project, e.g. C:\Users\rodrigo.espinosa\testing test\testProj. If you can get rid of the space it should allow you to authenticate for now.

We're triaging a fix but if you can confirm that fixes your problem for now it'd help a lot in making sure there's not another underlying root cause.

@smrobert09
Copy link

Just tried without a space in the project path without success. Callback to 1717 doesn't complete.

@qwikag
Copy link

qwikag commented Mar 2, 2021

I try not to put spaces in my paths for this very reason, so that issue is not relevant to my experience.
So that is a hard "no, not the issue here" :)

@qwikag
Copy link

qwikag commented Mar 2, 2021

Feel free to enage me directly to help with testing.
Happy to screen share and/or provide logs etc.
I am currently working directly for Salesforce with a customer.

@kevanmoothien
Copy link

@qwikag Can you try to downgrade to version 7.82? This works for me. Only the authorize an org hangs when I using later version. But with this version, everythings works fine.

@anupam081
Copy link

This is impacting me as well. none of the suggestions are working for me

@qwikag
Copy link

qwikag commented Mar 3, 2021

This is impacting me as well. none of the suggestions are working for me

Use this as a workaround for now:
sfdx auth:device:login -a MyAlias -r https://mydomain--sandbox.my.salesforce.com -s

@tronic111
Copy link

This is impacting me as well. none of the suggestions are working for me

Use this as a workaround for now:
sfdx auth:device:login -a MyAlias -r https://mydomain--sandbox.my.salesforce.com -s

I get:

ERROR running auth:device:login: Value is not a string

when trying to use the -r flag. Even against https://test.salesforce.com as suggested in their documentation

@kadantsam
Copy link
Author

This is impacting me as well. none of the suggestions are working for me

Use this as a workaround for now:
sfdx auth:device:login -a MyAlias -r https://mydomain--sandbox.my.salesforce.com -s

I get:

ERROR running auth:device:login: Value is not a string

when trying to use the -r flag. Even against https://test.salesforce.com as suggested in their documentation

I can confirm that this doesn't work. I had attempted it several times. There is something wrong with that option.

@superkencodes
Copy link

superkencodes commented Mar 3, 2021

Here is my work-around in case anyone is interested:

type this in your ide's terminal:
sfdx force:auth:device:login -r https://test.salesforce.com

you will be prompted with a response similar to this:

=== Action Required!
Enter X0C7TSHE user code in the verification URL https://test.salesforce.com/setup/connect

Click on the link and enter in the code, it will redirect you to the test.salesforce.com login page. From there just login to whatever sandbox you are trying to connect to your ide.

This worked for me and bypassed the Authorization hang and invalid session id errors I was faced with.

@prudev
Copy link

prudev commented Mar 3, 2021

I'm facing this issue to. I'm on Windows 10, VS Code version is 1.53.2, CLI version is sfdx-cli/7.89.2-d1d2614d02 win32-x64 node-v14.15.4.

The device flow work-around worked for me also:
sfdx force:auth:device:login -r https://test.salesforce.com

Please let us know when auth:web:login is fixed.

@cgjerdingen
Copy link

Multiple developers here are having the same issue here at Carlson School. auth:device:login workaround mentioned by @superkencodes worked for us.

Please let us know when this issue is resolved.

@tronic111
Copy link

This is impacting me as well. none of the suggestions are working for me

Use this as a workaround for now:
sfdx auth:device:login -a MyAlias -r https://mydomain--sandbox.my.salesforce.com -s

I get:
ERROR running auth:device:login: Value is not a string
when trying to use the -r flag. Even against https://test.salesforce.com as suggested in their documentation

I can confirm that this doesn't work. I had attempted it several times. There is something wrong with that option.

After completely removing Salesforce CLI from my system and everything else I could find related to it and then reinstalling I was able to get:

sfdx force:auth:device:login -r https://test.salesforce.com

to work.

@JohnTheRedeemer
Copy link

The sfdx force:auth:device:login worked for me, thanks for the workaround! Much less convenient than my normal worfklow, hopefully they fix this quick!

@shetzel
Copy link
Contributor

shetzel commented Mar 3, 2021

The fix was made in the @salesforce/core library for this and the @salesforce/plugin-auth plugin was updated (v1.4.10) to use that version. See this PR for details: forcedotcom/sfdx-core#384

We want to thank and give credit to @hansalves for submitting the PR. We cherry-picked and merged his fix to get it into a release as soon as possible.

There are some options for getting this fix.

  1. install sfdx-cli@latest-rc
  2. If you're already using latest-rc, update to the most recent version
  3. directly install the latest auth plugin. sfdx plugins:install @salesforce/plugin-auth. Just remember that you have it installed this way and are overriding the core version included with the CLI.
  4. latest-rc will be promoted to latest tomorrow so you could wait for that

In the process of moving code to open source there have been some unfortunate regressions with several of the new OSS plugins, auth is one of them. As we move the code we do our best to improve it (some of it was written 6 years ago and needed updating) while maintaining stability and ensuring parity with the old plugin version with unit tests, integration tests, etc. We're human and mistakes are made despite our best efforts. We try to get these issues addressed as quickly as possible and very much appreciate the effort and understanding of everyone in the community.

@CatoCoder
Copy link

Following

@qwikag
Copy link

qwikag commented Mar 5, 2021

BTW: If anyone can explain the difference between the win10 download versus the Node install, please visit here to answer my question on Stackexchange. https://salesforce.stackexchange.com/questions/335932/how-do-i-best-switch-versions-of-sfdx-and-plugins

All is well again for me. I am node connected.

sfdx --version:
sfdx-cli/7.90.2 win32-x64 node-v14.16.0
sfdx plugins --core
@oclif/plugin-autocomplete 0.3.0 (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.4.0-2 (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.8 (core)
auth 1.4.10 (core)
config 1.2.6 (core)
generator 1.1.5 (core)
salesforcedx 51.2.2 (core)
├─ limits 1.0.4 (core)
├─ user 1.1.2 (core)
├─ schema 1.0.4 (core)
├─ apex 0.1.4 (core)
├─ custom-metadata 1.0.11 (core)
├─ templates 51.3.0 (core)
├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
└─ salesforce-alm 51.2.1 (core)
sfdx-cli 7.90.2 (core)
telemetry 1.1.1 (core)

@qwikag
Copy link

qwikag commented Mar 5, 2021

Can someone advise what the fix was, and what it was related to.
The reason I ask is because the bug showed itself when the browser was trying to connect to localhost, and that has device implications.
So what was the general idea of the fix?

@hansalves
Copy link

hansalves commented Mar 5, 2021

@qwikag This is the commit that fixes the bug.

Basically the local server was created and set to listen to port 1717 but the event handler that processes the callback was only added if the server wasn't listening yet. Because of this, the handler was never added so the local server wouldn't do anything with the callback request and just hang.

@qwikag
Copy link

qwikag commented Mar 5, 2021

@hansalves
Thank you you for a concise answer that is great news!
So it means there were no external factors, and all the suggestions from the masses of port changes and proxys settings and system environment variables etc, was pointless, they probably had a different issue.

@lukethacoder
Copy link

lukethacoder commented Mar 6, 2021

@JohnTheRedeemer 's solution (using sfdx force:auth:device:login instead) seems to work nicely.

if you need to auth a sandbox org use the -r https://test.salesforce.com flag on the end of the command. can add an alias using -a YOUR_ORG_ALIAS too.

sfdx force:auth:device:login -r https://test.salesforce.com -a YOUR_ORG_ALIAS

updating the sfdx-cli to version 7.90.2 has fixed this up.

@paustint
Copy link

I encounter this issue every morning and run sfdx force:org:list, which seems to refresh the tokens for all of my orgs at once, then it works until the next morning.

@SimonPerez98
Copy link

i encounter the same issue Today with sfdx auth:web:login -d -a DevHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.