Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

337
Views
How to disable SSL certificate verification while post request in react JS?

I am trying to use keycloack for user authentication, I need to disable SSL verification for some testing purpose. In postman it works well if I disable SSL certificate verification. But in my react JS code it is giving me and error (net::ERR_CERT_AUTHORITY_INVALID) even it is disabled as shown in below code. Kindly correct me if anything missing in the below code or any else need to do.

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "password");
urlencoded.append("client_id", "clientid");
urlencoded.append("username", "username");
urlencoded.append("password", "password");
urlencoded.append("client_secret", "clientsecret");

const httpsAgent = new https.Agent({
    rejectUnauthorized: false,
  });

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: urlencoded,
  redirect: 'follow',
  Agent: httpsAgent
  
};

fetch("serverurl/realms/realmname/protocol/openid-connect/token", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

ERROR: net::ERR_CERT_AUTHORITY_INVALID

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As I got a workaround,

Just enter the request URL in the browser and if getting trust error, just click on Advanced and go with unsafe to load the request, it may required at least 3 attempts to do the same then page will load. and try the same request through react app then it will not give you such SSL error.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!