cli icon indicating copy to clipboard operation
cli copied to clipboard

SFDX: Authorize command giving error

Open sulemanzia opened this issue 3 years ago • 24 comments

Summary

After downloading SFDX v7.162.0 and enabling ENhanced domain in my dev sandbox, i tried authorizing the org using sfdx and everytime i tried to add my credentials in the oauth screen, i get an error message below : Error authenticating with auth code due to: request to https://test.salesforce.com//services/oauth2/token failed, reason: read ECONNRESET

This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

Steps To Reproduce:

  1. Download sfdx-cli version 7.162.0
  2. Login to your sandbox from your favorite browser
  3. Go to Setup -> My Domain -> Enable Enhanced Domain (Checked)
  4. Open VS Code and select command Pallet and select Authorize an Org
  5. Select Sandbox (test.salesforce.com)
  6. Once the browser is open, enter your sandbox credentials and click login. You will see the above error message displayed

Expected result

I should be able to authorize the org using Salesforce CLI with Enhanced Domain Enabled

Actual result

Received an error message mentioned above

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.) BASH

  • If you are using sfdx

    • Run sfdx version --verbose --json
  • If you are using sf

    • Run sf version AND sf plugins --core
  • Paste the output here "cliVersion": "sfdx-cli/7.162.0", "architecture": "win32-x64", "nodeVersion": "node-v16.16.0", "pluginVersions": [ "@oclif/plugin-autocomplete 0.3.0 (core)", "@oclif/plugin-commands 1.3.0 (core)", "@oclif/plugin-help 3.3.1 (core)", "@oclif/plugin-not-found 1.2.6 (core)", "@oclif/plugin-plugins 1.10.11 (core)", "@oclif/plugin-update 1.5.0 (core)", "@oclif/plugin-warn-if-update-available 1.7.3 (core)", "@oclif/plugin-which 1.0.4 (core)", "@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)", "alias 2.1.0 (core)", "apex 1.1.0 (core)", "auth 2.2.3 (core)", "community 2.0.0 (core)", "config 1.4.14 (core)", "custom-metadata 2.0.0 (core)", "data 2.1.1 (core)", "generator 2.0.2 (core)", "info 2.0.1 (core)", "limits 2.0.1 (core)", "org 2.0.7 (core)", "salesforce-alm 54.6.4 (core)", "schema 2.1.1 (core)", "sfdx-cli 7.162.0 (core)", "signups 1.2.0 (core)", "source 2.0.11 (core)", "telemetry 2.0.0 (core)", "templates 55.0.0 (core)", "trust 2.0.1 (core)", "user 2.1.0 (core)" ], "osVersion": "Windows_NT 10.0.19042"

sulemanzia avatar Aug 09 '22 13:08 sulemanzia

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.

github-actions[bot] avatar Aug 09 '22 13:08 github-actions[bot]

@sulemanzia When you retry the command does it succeed or does the error occur again?

peternhale avatar Aug 09 '22 15:08 peternhale

it's the same error no matter how many times i tried authorizing. The issue is with 2 // before services (https://test.salesforce.com//services)

Error authenticating with auth code due to: request to https://test.salesforce.com//services/oauth2/token failed, reason: read ECONNRESET

This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

sulemanzia avatar Aug 09 '22 15:08 sulemanzia

@sulemanzia I just tried auth of a sandbox via vscode Salesforce extension v55.8.0 - August 4, 2022 with sfdx-cli 7.162.0 and was able to auth w/o error.

Could you share your sfdx-project.json?

peternhale avatar Aug 09 '22 16:08 peternhale

peternhale: Did you also enable Enhanced domain on your sandbox ? Yep Sure. Here it is : { "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "55.0" }

sulemanzia avatar Aug 09 '22 16:08 sulemanzia

Yes enabled by default these days, https://....sandbox.my.salesforce.com

peternhale avatar Aug 09 '22 16:08 peternhale

hmmm. I am not sure what could be the reason of getting that error. If i run it with 7.85.0, it works fine and i am able to authorize. Even with 7.158.1 works fine as well but using 7.162.0, gives me that error..

sulemanzia avatar Aug 09 '22 16:08 sulemanzia

@sulemanzia to confirm, this worked with enhanced domains disabled?

peternhale avatar Aug 09 '22 16:08 peternhale

Hi Peter: I just confirmed by disabling enhanced domain and i am getting the same error.

sulemanzia avatar Aug 09 '22 16:08 sulemanzia

One variable removed :). I am going to try on Windows. I have been testing on Mac. I will let you know.

peternhale avatar Aug 09 '22 16:08 peternhale

@sulemanzia I tried and succeeded to a login to sandbox via vscode on a windows 11 machine.

I was wondering if you had any env vars set that begin with SF.

peternhale avatar Aug 09 '22 18:08 peternhale

Yep below is my env variables. NODE_TLS_REJECT_UNAUTHORIZED SFDX_AUTOUPDATE_DISABLE SFDX_IMPROVED_CODE_COVERAGE HTTP_PROXY HTTPS_PROXY

sulemanzia avatar Aug 09 '22 19:08 sulemanzia

Does your env require an outbound proxy?

peternhale avatar Aug 09 '22 19:08 peternhale

Currently it does.. But the proxy is not an issue since the previous versions of sfdx cli does not give me that oauth eror..

sulemanzia avatar Aug 09 '22 19:08 sulemanzia

Could you try the command outside of vscode and add the --json flag, then share the results.

peternhale avatar Aug 09 '22 19:08 peternhale

There you go :

$ sfdx auth:web:login -r https://test.salesforce.com --json (node:19292) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. (Use node --trace-warnings ... to show where the warning was created) { "status": 1, "name": "SfError", "message": "Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: request to https://test.salesforce.com//services/oauth2/token failed, reason: read ECONNRESET", "exitCode": 1, "context": "Login", "stack": "SfError: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: request to https://test.salesforce.com//services/oauth2/token failed, reason: read ECONNRESET\n at Login.run (C:\Users\blah\Development\sfdx\client\node_modules\@salesforce\plugin-auth\lib\commands\auth\web\login.js:51:23)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Login._run (C:\Users\blah\Development\sfdx\client\node_modules\@salesforce\command\lib\sfdxCommand.js:89:40)\n at async Config.runCommand (C:\Users\blah\Development\sfdx\client\node_modules\@oclif\config\lib\config.js:173:24)\n at async SfdxMain.run (C:\Users\blah\Development\sfdx\client\node_modules\@oclif\command\lib\main.js:27:9)\n at async SfdxMain._run (C:\Users\blah\Development\sfdx\client\node_modules\@oclif\command\lib\command.js:43:20)\n at async Object.run (C:\Users\blah\Development\sfdx\client\dist\cli.js:162:47)", "warnings": [ "apiVersion configuration overridden at "53.0"" ], "commandName": "Login" }

sulemanzia avatar Aug 09 '22 20:08 sulemanzia

Ok the exception thrown is coming from the jsforce library. At the moment of the failure we are trying to exchange an auth code for an access token.

I will discuss with team to see what steps might be next.

peternhale avatar Aug 09 '22 20:08 peternhale

Thanks Peter. Do you know which version of SFDX is compatible with Enhanced domains enabled ? The current version 7.162.0 is not working for me. Is v7.158.1 stable version for us to download and test our local development and CICD pipelines as well with Enhanced domain enable ?

The earlier version like 7.85.1 is not compatible with ENhanced domains due to intermittent authentication errors. Thanks for your support

sulemanzia avatar Aug 09 '22 20:08 sulemanzia

You can try 7.158.1 and let me know if this problem goes away. That would at least help narrow what we have to look at in change history.

peternhale avatar Aug 09 '22 20:08 peternhale

So far i am able to authorize using 7.158.1. Below are the sfdx logs

16:46:12.638 sfdx force:auth:web:login --setalias foo --instanceurl https://test.salesforce.com --setdefaultusername » Warning: sfdx-cli update available from 7.158.1 to 7.160.0. WARNING: apiVersion configuration overridden at "55.0" (node:4396) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. (Use node --trace-warnings ... to show where the warning was created) Successfully authorized [email protected] with org ID 00D2200000093BBBBB 16:46:34.365 sfdx force:auth:web:login --setalias foo --instanceurl https://test.salesforce.com --setdefaultusername ended with exit code 0

I will continue testijng the rest of the functionality using this version and will keep you updated. Thanks for your support. Also, please let us know what you find out as to why i am receicing that error with v7.162.0

sulemanzia avatar Aug 09 '22 20:08 sulemanzia

I am going to mark this as a bug.

peternhale avatar Aug 09 '22 21:08 peternhale

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

git2gus[bot] avatar Aug 09 '22 21:08 git2gus[bot]

I'm running into the same Issue as well. Error Message: Error authenticating with auth code due to: request to https://----ZZZZZZZZZ--iprdev.sandbox.my.salesforce.com//services/oauth2/token failed, reason: connect ETIMEDOUT 101.53.161.64:443

This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

SFDX Version: sfdx-cli/7.155.1 win32-x64 node-v16.15.1

Enhanced domains is enabled in the sandbox.

reddykrupananda avatar Aug 24 '22 10:08 reddykrupananda

For those still experiencing this problem, it would be interesting to compare the debug logs from a working CLI version and a non-working CLI version. If someone could provide the last ~100 lines of both logs it would help get to a solution faster. Just run your auth command and append --dev-debug and redirect the output to a file.

shetzel avatar Oct 10 '22 16:10 shetzel

Hello, I am also experiencing a similar issue WITHOUT enhanced domains enabled but getting different error messages. This was working fine 2 months ago. My company does use Netskope and so has it's own certificate however even setting NODE_TLS_REJECT_UNAUTHORIZED=0 still throws the same errors.

Browser error: Error authenticating with auth code due to: grant type not supported. Command-line error: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported

I've tried installing version 7.158.1 and get the same error as well.

Here is the last part of the output from --dev-debug (using version 7.175.0):

2022-11-07T19:01:42.317Z sfdx OS: 2022-11-07T19:01:42.317Z sfdx platform: win32 2022-11-07T19:01:42.317Z sfdx architecture: x64 2022-11-07T19:01:42.317Z sfdx release: 10.0.19042 2022-11-07T19:01:42.317Z sfdx shell: cmd.exe 2022-11-07T19:01:42.317Z sfdx NODE: 2022-11-07T19:01:42.317Z sfdx version: 18.12.1 2022-11-07T19:01:42.317Z sfdx CLI: 2022-11-07T19:01:42.317Z sfdx version: 7.175.0 2022-11-07T19:01:42.317Z sfdx channel: stable 2022-11-07T19:01:42.317Z sfdx bin: sfdx 2022-11-07T19:01:42.317Z sfdx data: C:\Users\allan.hotchkiss\AppData\Local\sfdx 2022-11-07T19:01:42.317Z sfdx cache: C:\Users\allan.hotchkiss\AppData\Local\sfdx 2022-11-07T19:01:42.317Z sfdx config: C:\Users\allan.hotchkiss\AppData\Local\sfdx 2022-11-07T19:01:42.317Z sfdx ENV: 2022-11-07T19:01:42.317Z sfdx NODE_OPTIONS: 2022-11-07T19:01:42.317Z sfdx SFDX_AUTOUPDATE_DISABLE: true 2022-11-07T19:01:42.317Z sfdx SFDX_BINPATH: 2022-11-07T19:01:42.317Z sfdx SFDX_COMPILE_CACHE: 2022-11-07T19:01:42.317Z sfdx SFDX_DISABLE_AUTOUPDATE: true 2022-11-07T19:01:42.317Z sfdx SFDX_ENV: development 2022-11-07T19:01:42.317Z sfdx SFDX_INSTALLER: 2022-11-07T19:01:42.317Z sfdx SFDX_NPM_REGISTRY: 2022-11-07T19:01:42.317Z sfdx SFDX_REDIRECTED: 2022-11-07T19:01:42.317Z sfdx SFDX_S3_HOST: 2022-11-07T19:01:42.317Z sfdx SFDX_UPDATE_INSTRUCTIONS: Use "npm update --global sfdx-cli" to update npm-based installations. 2022-11-07T19:01:42.318Z sfdx ARGS: 2022-11-07T19:01:42.318Z sfdx 0: C:\Program Files\nodejs\node.exe 2022-11-07T19:01:42.318Z sfdx 1: C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\bin\run 2022-11-07T19:01:42.318Z sfdx 2: auth:web:login 2022-11-07T19:01:42.318Z sfdx 3: --setalias 2022-11-07T19:01:42.318Z sfdx 4: full2 2022-11-07T19:01:42.318Z sfdx 5: --instanceurl 2022-11-07T19:01:42.318Z sfdx 6: https://test.salesforce.com 2022-11-07T19:01:42.318Z config start init hook 2022-11-07T19:01:42.419Z sf:core TRACE Setup child 'plugin-config:load_config_meta' logger instance 2022-11-07T19:01:42.419Z sfdx:@oclif/plugin-update:hooks:init start (require) C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@oclif\plugin-update\lib\hooks\init.js 2022-11-07T19:01:42.419Z sfdx:@salesforce/plugin-telemetry:hooks:init start (require) C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\plugin-telemetry\lib\hooks\telemetryInit.js 2022-11-07T19:01:42.419Z sfdx:@oclif/plugin-warn-if-update-available:hooks:init start (require) C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@oclif\plugin-warn-if-update-available\lib\hooks\init\check-update.js 2022-11-07T19:01:42.420Z sfdx:@salesforce/plugin-config:hooks:init start (require) C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\plugin-config\lib\hooks\init\load_config_meta.js 2022-11-07T19:01:42.421Z sf:plugin-config:load_config_meta INFO No config meta found for sfdx-cli 2022-11-07T19:01:42.421Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-community 2022-11-07T19:01:42.421Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-commands 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-update 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-custom-metadata 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-autocomplete 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-alias 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-version 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-help 2022-11-07T19:01:42.422Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-telemetry 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-not-found 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-plugins 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-templates 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-auth 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-apex 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-which 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @oclif/plugin-warn-if-update-available 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-limits 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-config 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-info 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-data 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-trust 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-org 2022-11-07T19:01:42.423Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-packaging 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-schema 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/sfdx-plugin-lwc-test 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-user 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-signups 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-source 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for @salesforce/plugin-generator 2022-11-07T19:01:42.424Z sf:plugin-config:load_config_meta INFO No config meta found for salesforce-alm 2022-11-07T19:01:42.424Z sfdx:@oclif/plugin-update:hooks:init done 2022-11-07T19:01:42.424Z sfdx:@salesforce/plugin-telemetry:hooks:init done 2022-11-07T19:01:42.424Z sfdx:@salesforce/plugin-config:hooks:init done 2022-11-07T19:01:42.425Z sfdx:@oclif/plugin-warn-if-update-available:hooks:init done 2022-11-07T19:01:42.425Z config init hook done 2022-11-07T19:01:42.425Z config runCommand auth:web:login [ '--setalias', 'full2', '--instanceurl', 'https://test.salesforce.com' ] 2022-11-07T19:01:42.457Z config:@salesforce/plugin-auth (require) C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\plugin-auth\lib\commands\auth\web\login.js 2022-11-07T19:01:42.457Z config start prerun hook 2022-11-07T19:01:42.537Z sfdx:@salesforce/plugin-telemetry:hooks:prerun start (require) C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\plugin-telemetry\lib\hooks\telemetryPrerun.js 2022-11-07T19:01:42.538Z sf:core TRACE Setup child 'Config' logger instance 2022-11-07T19:01:42.539Z sf:core TRACE Setup child 'Config' logger instance 2022-11-07T19:01:42.539Z sf:Config INFO Reading config file: C:\Users\allan.hotchkiss.sf\config.json 2022-11-07T19:01:42.540Z sf:Config INFO Reading config file: C:\Users\allan.hotchkiss\Dev\stonex-salesforce.sf\config.json 2022-11-07T19:01:42.549Z sf:Config INFO Reading config file: C:\Users\allan.hotchkiss.sf\config.json 2022-11-07T19:01:42.549Z sf:Config INFO Reading config file: C:\Users\allan.hotchkiss\Dev\stonex-salesforce.sf\config.json 2022-11-07T19:01:42.558Z sf:core TRACE Setup child 'core:config' logger instance 2022-11-07T19:01:42.566Z sfdx:[email protected] Usage acknowledgement file already exists 2022-11-07T19:01:42.566Z sfdx:[email protected] Using telemetry logging file C:\Users\ALLAN~1.HOT\AppData\Local\Temp\sfdx-telemetry\telemetry-b07cfd386f52648d04c0bb0aeb3d3eb1417be6af.log 2022-11-07T19:01:42.572Z sfdx:[email protected] Setting up process exit handler 2022-11-07T19:01:42.573Z sfdx:@salesforce/plugin-telemetry:hooks:prerun done 2022-11-07T19:01:42.573Z config prerun hook done 2022-11-07T19:01:42.574Z sf:core TRACE Setup child 'Login' logger instance 2022-11-07T19:01:42.574Z sfdx:auth:web:login init version: @oclif/[email protected] argv: [ '--setalias', 'full2', '--instanceurl', 'https://test.salesforce.com' ] 2022-11-07T19:01:42.575Z sf:Login INFO Running command [Login] with flags [{"setalias":"full2","instanceurl":"https://test.salesforce.com/","loglevel":"warn"}] and args [{}] 2022-11-07T19:01:42.575Z sf:Config INFO Reading config file: C:\Users\allan.hotchkiss.sf\config.json 2022-11-07T19:01:42.576Z sf:Config INFO Reading config file: C:\Users\allan.hotchkiss\Dev\stonex-salesforce.sf\config.json 2022-11-07T19:01:42.583Z sf:core TRACE Setup child 'core:config' logger instance 2022-11-07T19:01:42.583Z sf:core:config INFO Key org-metadata-rest-deploy already exists in allowedProperties, skipping. 2022-11-07T19:01:42.591Z sf:core TRACE Setup child 'Common' logger instance 2022-11-07T19:01:42.591Z sf:core TRACE Setup child 'WebOAuthServer' logger instance 2022-11-07T19:01:42.592Z sf:core TRACE Setup child 'SfProjectJson' logger instance 2022-11-07T19:01:42.592Z sf:SfProjectJson INFO Reading config file: C:\Users\allan.hotchkiss\Dev\stonex-salesforce\sfdx-project.json 2022-11-07T19:01:42.594Z sf:SfProjectJson TRACE Setup child 'SchemaValidator' logger instance 2022-11-07T19:01:42.594Z sf:SchemaValidator DEBUG Schema loaded for C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\schemas\sfdx-project.schema.json 2022-11-07T19:01:42.640Z sf:core TRACE Setup child 'WebServer' logger instance 2022-11-07T19:01:42.641Z sf:WebServer DEBUG Starting web server 2022-11-07T19:01:42.649Z sf:WebServer DEBUG Nothing listening on host: localhost port: 1717 - good! 2022-11-07T19:01:42.669Z sf:WebOAuthServer DEBUG OAuth web login service listening on port: 1717 2022-11-07T19:01:42.669Z sf:WebOAuthServer DEBUG Starting web auth flow 2022-11-07T19:01:49.787Z sf:WebServer DEBUG socket connection initialized from ::1 2022-11-07T19:01:49.787Z sf:WebServer DEBUG socket connection initialized from ::1 2022-11-07T19:01:49.789Z sf:WebOAuthServer DEBUG processing request for uri: /OauthRedirect 2022-11-07T19:01:49.790Z sf:WebOAuthServer DEBUG request.query.state: 84fb4b78efdc 2022-11-07T19:01:49.791Z sf:WebOAuthServer DEBUG Successfully obtained auth code: ...OTg== 2022-11-07T19:01:49.791Z sf:WebOAuthServer DEBUG oauthConfig.loginUrl: https://test.salesforce.com/ 2022-11-07T19:01:49.791Z sf:WebOAuthServer DEBUG oauthConfig.clientId: PlatformCLI 2022-11-07T19:01:49.791Z sf:WebOAuthServer DEBUG oauthConfig.redirectUri: http://localhost:1717/OauthRedirect 2022-11-07T19:01:49.792Z sf:core TRACE Setup child 'OrgAccessor' logger instance 2022-11-07T19:01:49.792Z sf:core TRACE Setup child 'SandboxAccessor' logger instance 2022-11-07T19:01:49.793Z sf:core TRACE Setup child 'AliasesConfig' logger instance 2022-11-07T19:01:49.793Z sf:AliasesConfig INFO Reading config file: C:\Users\allan.hotchkiss.sfdx\alias.json 2022-11-07T19:01:49.794Z sf:core TRACE Setup child 'TokensConfig' logger instance 2022-11-07T19:01:49.794Z sf:core TRACE Setup child 'crypto' logger instance 2022-11-07T19:01:49.794Z sf:crypto DEBUG retryStatus: undefined 2022-11-07T19:01:49.795Z sf:core TRACE Setup child 'keyChain' logger instance 2022-11-07T19:01:49.795Z sf:keyChain DEBUG platform: win32 2022-11-07T19:01:49.798Z sf:TokensConfig INFO Reading config file: C:\Users\allan.hotchkiss.sfdx\tokens.json 2022-11-07T19:01:49.799Z sf:core TRACE Setup child 'AuthInfo' logger instance 2022-11-07T19:01:49.799Z sf:AuthInfo INFO Exchanging auth code for access token using loginUrl: https://test.salesforce.com/ 2022-11-07T19:01:50.149Z sf:core TRACE Setup child 'auth' logger instance 2022-11-07T19:01:50.149Z sf:auth DEBUG 2022-11-07T19:01:50.149Z sf:WebOAuthServer DEBUG closing server connection ERROR running auth:web:login: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported *** Internal Diagnostic ***

SfError: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported at Login.run (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\plugin-auth\lib\commands\auth\web\login.js:51:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Login._run (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\command\lib\sfdxCommand.js:102:40) at async Config.runCommand (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@oclif\core\lib\config\config.js:272:25) at async run (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@oclif\core\lib\main.js:76:5)


2022-11-07T19:01:50.152Z sf:Login ERROR [ 'ERROR running auth:web:login: ', 'Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported', '\n' + '*** Internal Diagnostic \n' + '\n' + 'SfError: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported\n' + ' at Login.run (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\@salesforce\plugin-auth\lib\commands\auth\web\login.js:51:23)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at async Login._run (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\@salesforce\command\lib\sfdxCommand.js:102:40)\n' + ' at async Config.runCommand (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\@oclif\core\lib\config\config.js:272:25)\n' + ' at async run (C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules\@oclif\core\lib\main.js:76:5)\n' + '***\n' ] 2022-11-07T19:01:50.154Z config start postrun hook 2022-11-07T19:01:50.154Z config postrun hook done 2022-11-07T19:01:50.156Z sf:WebServer DEBUG number of connections open: 0 2022-11-07T19:01:50.158Z sfdx:[email protected] Spawning "C:\Program Files\nodejs\node.exe C:\Users\allan.hotchkiss\AppData\Roaming\npm\node_modules\sfdx-cli\node_modules@salesforce\plugin-telemetry\processes\upload C:\Users\allan.hotchkiss\AppData\Local\sfdx C:\Users\ALLAN~1.HOT\AppData\Local\Temp\sfdx-telemetry\telemetry-b07cfd386f52648d04c0bb0aeb3d3eb1417be6af.log"

ENV variables:

NODE_EXTRA_CA_CERTS=C:\ProgramData\netskope\stagent\data\nscacert_combined.pem NODE_TLS_REJECT_UNAUTHORIZED=1

hotcher2 avatar Nov 07 '22 19:11 hotcher2

@hotcher2 that's a separate error unrelated to this issue with your certs.

mshanemc avatar Nov 07 '22 22:11 mshanemc

I got the same issue when Enhance Domain enabled, and sfdx-cli/7.176.1

manhntbkit avatar Nov 13 '22 01:11 manhntbkit

I am getting the below error. can anyone help me please.

Error authenticating with auth code due to: request to https://test.salesforce.com//services/oauth2/token failed, reason: Client network socket disconnected before secure TLS connection was established

This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

vamshisfdcdev avatar Dec 05 '22 06:12 vamshisfdcdev

Could not retrieve the username after successful auth code exchange. Due to: request to https://MySandbox--Name.sandbox.my.salesforce.com/services/oauth2/userinfo failed, reason: connect ETIMEDOUT 54.66.196.247:443 This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again. "cliVersion": "sfdx-cli/7.179.0" "architecture": "win32-x64",

EziWorx avatar Dec 06 '22 08:12 EziWorx

I am continuing to have this issue, I cannot authorize VScode to any sandbox with error: Error authenticating with auth code due to: grant type not supported This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

Below are logs from command (sfdx force:auth:web:login -r https://test.salesforce.com --dev-debug)

sfdx:@oclif/plugin-update:hooks:init done +16ms
  sfdx:@salesforce/plugin-telemetry:hooks:init done +15ms
  sfdx:@salesforce/plugin-config:hooks:init done +14ms
  sfdx:@oclif/plugin-warn-if-update-available:hooks:init done +27ms
  config init hook done +366ms
  config runCommand force:auth:web:login [ '-r', 'https://test.salesforce.com' ] +3ms
  config:@salesforce/plugin-auth (require) C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@salesforce\plugin-auth\lib\commands\auth\web\login.js +501ms
  config start prerun hook +42ms
  sfdx:@salesforce/plugin-telemetry:hooks:prerun start (require) C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@salesforce\plugin-telemetry\lib\hooks\telemetryPrerun.js +0ms
  sf:core TRACE Setup child 'Config' logger instance +200ms
  sf:core TRACE Setup child 'Config' logger instance +2ms
  sf:Config INFO Reading config file: C:\Users\cecrabtree\.sf\config.json +0ms
  sf:Config INFO Reading config file: C:\Users\cecrabtree\OneDrive - AAA Carolinas\Code\Field Service\AE965newProject\.sf\config.json +2ms
  sf:Config INFO Reading config file: C:\Users\cecrabtree\.sf\config.json +14ms
  sf:Config INFO Reading config file: C:\Users\cecrabtree\OneDrive - AAA Carolinas\Code\Field Service\AE965newProject\.sf\config.json +2ms
  sf:core TRACE Setup child 'core:config' logger instance +34ms
  sfdx:[email protected] Usage acknowledgement file already exists +0ms
  sfdx:[email protected] Using telemetry logging file C:\Users\CECRAB~1\AppData\Local\Temp\sfdx-telemetry\telemetry-41b4687d257c9d6e826378a624c4fb2e2ba9013b.log +1ms
  sfdx:[email protected] Setting up process exit handler +8ms
  sfdx:@salesforce/plugin-telemetry:hooks:prerun done +62ms
  config prerun hook done +177ms
  sf:core TRACE Setup child 'Login' logger instance +27ms
  sfdx:auth:web:login init version: @oclif/[email protected] argv: [ '-r', 'https://test.salesforce.com' ] +0ms
  sf:Login INFO Running command [Login] with flags [{"instanceurl":"https://test.salesforce.com/","loglevel":"warn"}] and args [{}] +0ms
  sf:Config INFO Reading config file: C:\Users\cecrabtree\.sf\config.json +46ms
  sf:Config INFO Reading config file: C:\Users\cecrabtree\OneDrive - AAA Carolinas\Code\Field Service\AE965newProject\.sf\config.json +2ms
  sf:core TRACE Setup child 'core:config' logger instance +22ms
  sf:core:config INFO Key org-metadata-rest-deploy already exists in allowedProperties, skipping. +0ms
  sf:core TRACE Setup child 'Common' logger instance +14ms
  sf:core TRACE Setup child 'WebOAuthServer' logger instance +1ms
  sf:core TRACE Setup child 'SfProjectJson' logger instance +2ms
  sf:SfProjectJson INFO Reading config file: C:\Users\cecrabtree\OneDrive - AAA Carolinas\Code\Field Service\AE965newProject\sfdx-project.json +0ms
  sf:core TRACE Setup child 'WebServer' logger instance +4ms
  sf:WebServer DEBUG Starting web server +0ms
  sf:WebServer DEBUG Nothing listening on host: localhost port: 1717 - good! +8ms
  sf:WebOAuthServer DEBUG OAuth web login service listening on port: 1717 +0ms
  sf:WebOAuthServer DEBUG Starting web auth flow +1ms
  sf:WebServer DEBUG socket connection initialized from ::1 +11s
  sf:WebServer DEBUG socket connection initialized from ::1 +1ms
  sf:WebOAuthServer DEBUG processing request for uri: /OauthRedirect +11s
  sf:WebOAuthServer DEBUG request.query.state: d83d5ffeaf74 +1ms
  sf:WebOAuthServer DEBUG Successfully obtained auth code: ..._GA== +2ms
  sf:WebOAuthServer DEBUG oauthConfig.loginUrl: https://test.salesforce.com/ +0ms
  sf:WebOAuthServer DEBUG oauthConfig.clientId: PlatformCLI +1ms
  sf:WebOAuthServer DEBUG oauthConfig.redirectUri: http://localhost:1717/OauthRedirect +0ms
  sf:core TRACE Setup child 'OrgAccessor' logger instance +11s
  sf:core TRACE Setup child 'SandboxAccessor' logger instance +2ms
  sf:core TRACE Setup child 'AliasesConfig' logger instance +1ms
  sf:AliasesConfig INFO Reading config file: C:\Users\cecrabtree\.sfdx\alias.json +0ms
  sf:core TRACE Setup child 'TokensConfig' logger instance +3ms
  sf:core TRACE Setup child 'crypto' logger instance +2ms
  sf:crypto DEBUG retryStatus: undefined +0ms
  sf:core TRACE Setup child 'keyChain' logger instance +1ms
  sf:keyChain DEBUG platform: win32 +0ms
  sf:TokensConfig INFO Reading config file: C:\Users\cecrabtree\.sfdx\tokens.json +0ms
  sf:core TRACE Setup child 'AuthInfo' logger instance +6ms
  sf:AuthInfo INFO Exchanging auth code for access token using loginUrl: https://test.salesforce.com/ +0ms
(node:572) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
    at getAllowUnauthorized (node:internal/options:58:13)
    at Object.connect (node:_tls_wrap:1609:29)
    at Agent.createConnection (node:https:150:22)
    at Agent.createSocket (node:_http_agent:350:26)
    at Agent.addRequest (node:_http_agent:297:10)
    at new ClientRequest (node:_http_client:335:16)
    at request (node:https:360:10)
    at C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\node-fetch\lib\index.js:1468:15
    at new Promise (<anonymous>)
    at fetch (C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\node-fetch\lib\index.js:1437:9)
  sf:core TRACE Setup child 'auth' logger instance +397ms
  sf:auth DEBUG  +0ms
  sf:WebOAuthServer DEBUG closing server connection +416ms
ERROR running auth:web:login:  Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported
*** Internal Diagnostic ***

SfError: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported
    at Login.run (C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@salesforce\plugin-auth\lib\commands\auth\web\login.js:51:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Login._run (C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@salesforce\command\lib\sfdxCommand.js:102:40)
    at async Config.runCommand (C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@oclif\core\lib\config\config.js:272:25)
    at async run (C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@oclif\core\lib\main.js:74:5)
******

  sf:Login ERROR [
  sf:Login   '\x1B[1mERROR running auth:web:login: \x1B[22m',
  sf:Login   '\x1B[31mInvalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported\x1B[39m',
  sf:Login   '\x1B[31m\x1B[39m\n' +
  sf:Login     '\x1B[31m*** Internal Diagnostic ***\x1B[39m\n' +
  sf:Login     '\x1B[31m\x1B[39m\n' +
  sf:Login     '\x1B[31mSfError: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: grant type not supported\x1B[39m\n' +
  sf:Login     '\x1B[31m    at Login.run (C:\\Users\\cecrabtree\\AppData\\Local\\sfdx\\client\\7.181.1-05b8719\\node_modules\\@salesforce\\plugin-auth\\lib\\commands\\auth\\web\\login.js:51:23)\x1B[39m\n' +
  sf:Login     '\x1B[31m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\x1B[39m\n' +
  sf:Login     '\x1B[31m    at async Login._run (C:\\Users\\cecrabtree\\AppData\\Local\\sfdx\\client\\7.181.1-05b8719\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:102:40)\x1B[39m\n' +  
  sf:Login     '\x1B[31m    at async Config.runCommand (C:\\Users\\cecrabtree\\AppData\\Local\\sfdx\\client\\7.181.1-05b8719\\node_modules\\@oclif\\core\\lib\\config\\config.js:272:25)\x1B[39m\n' +  sf:Login     '\x1B[31m    at async run (C:\\Users\\cecrabtree\\AppData\\Local\\sfdx\\client\\7.181.1-05b8719\\node_modules\\@oclif\\core\\lib\\main.js:74:5)\x1B[39m\n' +
  sf:Login     '\x1B[31m******\x1B[39m\n' +
  sf:Login     '\x1B[31m\x1B[39m'
  sf:Login ] +11s
  config start postrun hook +11s
  config postrun hook done +2ms
  sf:WebServer DEBUG number of connections open: 0 +456ms
  sfdx:[email protected] Spawning "C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\bin\node.exe C:\Users\cecrabtree\AppData\Local\sfdx\client\7.181.1-05b8719\node_modules\@salesforce\plugin-telemetry\processes\upload C:\Users\cecrabtree\AppData\Local\sfdx C:\Users\CECRAB~1\AppData\Local\Temp\sfdx-telemetry\telemetry-41b4687d257c9d6e826378a624c4fb2e2ba9013b.log" +11s
PS C:\Users\cecrabtree\OneDrive - AAA Carolinas\Code\Field Service\AE965newProject>

claireSFDC avatar Dec 21 '22 16:12 claireSFDC