callback에 나온 토큰값을 디비로 저장할 수 있을까요?

질문많이 해도 되나요??^^ 답변을 너무 잘해주셔서 의지하고 있습니다. 감사합니다.ㅠㅠ
index페이지에서 callback해서 토큰값을 갱신했습니다.
callback 화면에서 갱신된 값을 디비에 저장해서 사용하고 싶은데. callback.jsp 가능할까요?
1. index.jsp

<%@ page import = "com.restfb.exception.FacebookOAuthException" %>
<%@ page import = "com.restfb.Parameter" %>
<%@ page import = "com.restfb.types.FacebookType" %>
<%@ page import = "com.restfb.DefaultFacebookClient" %>
<%@ page import = "java.util.List" %>
<%@ page import = "com.restfb.types.User" %>
<%@ page import = "java.net.*" %>   
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>twitter api</title>
</head>
<body>
 
 fb api<br/>
 <%
   String appID = "164358633992818";
     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=offline_access";;
     response.sendRedirect(oauthUrl);
    
 
 %>
 
 

</body>
</html>


2. callback.jsp


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import ="java.net.*,java.io.*" %>
<%@ page import = "com.restfb.exception.FacebookOAuthException" %>
<%@ page import = "com.restfb.Parameter" %>
<%@ page import = "com.restfb.types.FacebookType" %>
<%@ page import = "com.restfb.DefaultFacebookClient" %>
<%@ page import = "com.restfb.types.User" %>
<%@ include file="/include/const.jsp"%>
<%@ include file="/include/db/db_connect.jsp"%>
<%@ include file="/include/function/function.jsp"%>

<%
        String code = request.getParameter("code");
        String appID = "164358633992818";
        String appSecret = "1ab1d0b51b7788a8cbeaa7e9a6b167e4";
        String callbackUrl = "http://localhost/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;
        String accessToken2 = null;
       
        while ((accessToken = in.readLine()) != null)
       
        in.close();

      

%>


 

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요