2

I have been using VS Code and Salesforce since a year in my company laptop.

I am trying to authorize VS code with my sandbox.

Process I followed:

VS Code> Sfdx auth org shortcut Also tried sfdx force:auth:web:login --setalias SFDev --instanceurl https://test.salesforce.com --setdefaultusername Every time I get below error in browser:

Error authenticating with auth code due to: request to https://login.salesforce.com//services/oauth2/token failed, reason: self-signed certificate in certificate chain

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

And below error on VS code:

Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: request to https://login.salesforce.com//services/oauth2/token failed, reason: self-signed certificate in certificate chain

Tried some ways like NODE_TLS_REJECT_UNAUTHORIZED = 0 and Clearing cookies and caches. or Reinstalling CLI.

Nothing works so far. have been struggling from some time. Please help out.

2
  • Did anything happened to your company firewall rules? They might be blocking Mar 23, 2023 at 16:36
  • reason: self-signed certificate in certificate chain usually means your company is intercepting the request and performing a man-in-the-middle SSL intermediation.
    – identigral
    Mar 23, 2023 at 18:00

3 Answers 3

0

if you are facing error like :

Error authenticating with auth code due to: request to https:/test.salesforce/services/token failed, reason: self-signed certificate in certificate chain

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

Answer : when you are trying to authenticate your org from vs code try using custom URL option.

for me this worked !

enter image description here

0

I was experiencing the same issue and it turned out to be on my company's network.

(if possible) Turn off VPN and any sort of traffic monitor like Netskope. I was able to disconnect from VPN and then everything started working for me.

If you don't have the ability to do that, download VS Code on a home device and retest it, I bet you it doesn't have the same problem.

0

If you use web content filtering software like Websense, disable it when authorizing an org as suggested by Integral in his comment above. Otherwise, they inspect SSL traffic and can cause cert errors.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .