I was able to get 200 once I hit the curl code in a terminal so I assume how I write testStytch is ok so far. But once I tried to integrate into a java file, I get a bad request response. I am kind a no clue right now. https://github.com/libetl/curl this is what I referred to convert my curl code.
This is the error I got. HttpResponseProxy{HTTP/1.1 400 Bad Request [Date: Thu, 22 Apr 2021 23:21:42 GMT, Content-Type: application/json, Content-Length: 189, Connection: keep-alive, Traceparent: 00-d3a39218eb8d091ffe3bf5cb474692ce-353a1a23da4e5dc4-01] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 189,Chunked: false]}}
@RequestMapping(value = "/loginByStytch" , method = RequestMethod.POST)
public synchronized String loginByStytch(ModelMap model, HttpServletRequest
request) throws Exception {
mapper = new ObjectMapper();
String hashPassword;
UserInfoBean userInfoBean = mapper.readValue(request.getParameter("data"),
new TypeReference<UserInfoBean>() { });
String testStytch = "-k -X POST 'https://test.stytch.com/v1/magic_links/send_by_email' -u project-test-b3ca64c2-b0c8d73:secret-test-s5lO3O -H 'Content-Type: application/json' -d '{\"email\":\"[email protected]\",\"magic_link_url\":\"http://localhost:8080/ROOT/NC/authenticateByStytch\",\"expiration_minutes\":500}'";
HttpResponse response = curl(testStytch);
InputStream inputStream = response.getEntity().getContent();
String jsonContent = convert(inputStream, Charset.forName("UTF-8"));
request.getSession().setAttribute(Constant.SESSION_NAME, null);
return "redirect:/timeline";
}