我不能夠在認證stripe.com - 使用基本身份驗證條紋認證
public class Str extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw=response.getWriter();
pw.println("Hello World");
HttpClient client= new HttpClient();
String req="https://api.stripe.com/";
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(new AuthScope(req, 443, null), new UsernamePasswordCredentials("<api-key>"));
client.getHostConfiguration().setHost(req, 443, "https");
PostMethod post= new PostMethod("https://api.stripe.com/v1/charges/");
//post.addParameter("id", "<id>");
int status=client.executeMethod(post);
pw.println(status);
}
}
我提出我的代碼......在這裏我HV使用HTTP基本認證,以提供用戶憑據stripe.com
什麼,當你嘗試會發生什麼? – Ashe
它表示沒有找到默認憑證。並且驗證失敗 – behinddwalls
爲什麼不使用條帶Java綁定? https://stripe.com/docs/libraries – brian