2015-01-19 1 views
0

내 응용 프로그램에서 소셜 웹 사이트 로그인을위한 상용 솔루션을 찾으려고합니다. janrain 서버에 연결하려고하면 m 연결이 거부됩니다.내 응용 프로그램에서 소셜 웹 사이트 로그인을위한 상용 솔루션을 찾으려고합니다.

public class AuthInfo extends HttpServlet { 

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { 
     // The user's browser will POST a token to your "token_url" you specified to have them 
     // redirected to after the auth process: 
     String token = request.getParameter("token"); 
     // Do a request to the Janrain API with the token we just received. 
     // see http://developers.janrain.com/documentation/api/auth_info/ 
     // You may wish to make this HTTP request with e.g. Apache HttpClient instead. 
     URL url = new URL("https://rpxnow.com/api/v2/auth_info"); 
     String params = String.format("apiKey=%s&token=%s", 
      URLEncoder.encode(getServletConfig().getInitParameter("apiKey"), "UTF-8"), 
      URLEncoder.encode(token, "UTF-8") 
     ); 
     HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 
     connection.setRequestMethod("POST"); 
     connection.setDoOutput(true); 

     connection.connect();//** Failing here ** 

     OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), "UTF-8"); 
     writer.write(params); 
     writer.close(); 
+0

이 예외에는 여러 가지 이유가 있습니다. 내 연습에서는 URL이 맞고 웹 서버가 다운되지 않았다고 확신하는 경우 가장 자주 프록시 문제가 발생합니다. 하지만 가능한 데이터를 기반으로, 그것은 추측하려는 것 이상입니다. – Cuzz

+0

답장을 보내 주셔서 감사합니다 ... URL이 맞으며 웹 ​​서버가 제안대로 작동합니다. – sanjeev

+0

및 프록시는 어떻게됩니까? 앱에서 요청을 보내야합니까? – Cuzz

답변

0

URL에 소셜 로그인 (Engage) 애플리케이션의 이름이 필요합니다. Janrain 대시 보드의 "Application Settings"섹션에서 정확한 URL을 얻을 수 있습니다.

그래서 https://rpxnow.com/api/v2/auth_infohttps://YOUR_APP_NAME.rpxnow.com/api/v2/auth_info과 같아야합니다.

관련 문제