[SalesForce] ERROR running force:auth:web:login: unable to get local issuer certificate – When Authorizing an Org in VS code

I have installed VS code and Salesforce CLI in my system.Now when I try to Authorize an Org using SFDC:Authorize an Org, It take me to the login page and also logs in and redirects to localhost:1717.

I get the below error

This page isn’t working localhost didn’t send any data.
ERR_EMPTY_RESPONSE

And the Url has this: http://localhost:1717/OauthRedirect?code=aPrxeoyeTpu7VD8TU5.MiH8R70GBrrinzlZHNm4qsQVi8SNWqfbyMGt33D.8taJ4_dX1cMu6JQ%3D%3D&state=e4365ba68ae7

I have tried to check if the port 1717 is free or used. Its free.
Tried using personal network still same issue.

Please help me in getting this resolved.

Thanks,
sfdcdev

Best Answer

The Salesforce CLI use NodeJS to handle the authentication between client and Salesforce server

When you use a proxy or your network not transparent the https will occur the error

You can skip the error by set bellow variable in environment on your pc NODE_TLS_REJECT_UNAUTHORIZED = 0 Note: you must restart the CMD or VSC after set variables.

Read more: Salesforce CLI Environment Variables https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_env_variables.htm

How to creating and Modifying Environment Variables on Windows https://docs.oracle.com/en/database/oracle/r-enterprise/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html