3

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 Commented 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
    Commented Mar 23, 2023 at 18:00

4 Answers 4

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

1
  • this didn't work for me unfortunately
    – Cloud Man
    Commented Jun 10 at 18:20
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.

0

With 'Salesforce CLI' Custom app permission enabled as well as 'API Enabled' at Profile-level, I was still receiving error.

Logging off of my company's VPN immediately resolved issue for me. Hope you find the same.

You must log in to answer this question.

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