SAP Business One Service Layer Login API net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH error

178 views Asked by At

So I've been trying to play around with the SAP business one service layer apis to build some internal tools. However I get the error net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH error while I'm trying to send a login POST request using react axios. I created a simple login button and when I click on it, I get that error in the console. I've tested the login api with postman and get the correct response but to no success with my code. Our current SAP version is 9.3 and we plan to finish our upgrade by the end of the year. However, I still want to test out the apis so that I'll be able to implement them faster in the future.

The following is my code:


import './App.css';
import { Button } from 'react-bootstrap';
import "bootstrap/dist/css/bootstrap.min.css";
import axios from 'axios';
import https from 'https'

function App() {

  const loginData ={
    "CompanyDB": "CompanyDB",
    "UserName": "UserName",
    "Password": "Password"
}

  // At request level
  const agent = new https.Agent({
    rejectUnauthorized: false
  });

  const login = ()=>{
    axios.post('MYSERVER:50000/b1s/v1/Login',loginData,{httpsAgent:agent}).then(res=>{
      console.log(res)
    }).catch(err=>{
      console.log(err)
    })
  }
  return (
    <div className="App">
      <Button onClick={login}>Login</Button>
    </div>
  );
}

export default App;```


Some things I tried but I still get the error:
1. Creating an https agent and setting rejectUnAuthorized to false.
2. Adding process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; to the top of my code.
3. Enabling TLS 1.0 in my internet properties.
0

There are 0 answers