Graph API Explorer 앱 이용시.. access token

안녕하세요. 오전에 질문드렸었는데,

페이스북 앱을 하나 만들어서 사용하고 있는데요, 앱관리 edit App 메뉴에서 좌측하단 메뉴에 보면 Use Graph API Explorer 라는 링크가 있더라구요,

부가기능에 제가 만든 앱이름과 Graph API Explorer 가 있어서

혹시나해서 Graph API Explorer 의 access token을 새로 받아 게시글을 등록해보니 제 계정뿐아니라 다른 계정 사용자들도 게시글이 보이던데

Graph API Explorer 액세스토큰을 얻으려면 다른 방법으로 개발을 해야하나요? 기존에는 app id 와, app secret 코드를 사용하잖아요?

Graph API Explorer에서도 생성되있는 id가 있던데, 이 id로 변경해봐도 소용은 없더라구요..

api 설명을 봐도 모르겠고 해서 도움 요청드립니다.

 

====index.jsp

<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>twitter api</title>
</head>
<body>
 
 fb api<br/>
 <%
   String appID = "13548216848735432748";
     String callbackUrl = "http://" + request.getServerName() + "/facebook/callback.jsp";
    String oauthUrl = "https://www.facebook.com/dialog/oauth?" +
                        "client_id="+ appID + "&redirect_uri=" + URLEncoder.encode(callbackUrl, "UTF-8")+
                        "&scope=publish_stream, offline_access";
     response.sendRedirect(oauthUrl);
  
 %>
 
 

</body>
</html>

 

==== callback.jsp

 

<%
      String code = request.getParameter("code");
      String appID = "13548216848735432748";
      String appSecret = "1db1dasdfeseree4a7e966b16ce4";
      String callbackUrl = "http://" + request.getServerName() + "/facebook/callback.jsp";
      String access_token_url = "https://graph.facebook.com/oauth/access_token?"
              + "client_id="+ appID
              + "&redirect_uri=" + URLEncoder.encode(callbackUrl, "UTF-8")
              + "&client_secret=" + appSecret + "&code=" + code;
    

      URL yahoo = new URL(access_token_url);
      URLConnection yc = yahoo.openConnection();
      BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
     
      String accessToken = null;

   accessToken = in.readLine();
   accessToken = accessToken.substring(accessToken.indexOf("=")+1, accessToken.indexOf("&"));

      in.close();

 

%>

 

=======insert.jsp


     FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
     FacebookType publishMessageResponse = facebookClient.publish("me/feed", FacebookType.class, Parameter.with("message", "게시글 내용"));
 

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기