使用Facebook Java API获取会话密钥

使用Facebook Java API获取会话密钥,java,facebook,session,key,Java,Facebook,Session,Key,我正在开发一个Facebook应用程序。在这个应用程序中,我使用Google提供的JavaAPI,该应用程序基于web 我有facebook\u api\u密钥和facebook\u secret,但是如何获取sessionKey 此代码不是基于web的: FacebookJsonRestClient client = new FacebookJsonRestClient(Test.API_KEY, Test.SECRET); String token = client.auth_createT

我正在开发一个Facebook应用程序。在这个应用程序中,我使用Google提供的JavaAPI,该应用程序基于web

我有
facebook\u api\u密钥
facebook\u secret
,但是如何获取
sessionKey

此代码不是基于web的:

FacebookJsonRestClient client = new FacebookJsonRestClient(Test.API_KEY, Test.SECRET);
String token = client.auth_createToken();
String url = "http://www.facebook.com/login.php?api_key=";
url += Test.API_KEY;
url += "&v=1.0";
url += "&auth_token=";
url += token;
String strCommand = "C:/Program Files/Internet Explorer/IEXPLORE.EXE ";
strCommand += url;
Runtime.getRuntime().exec(strCommand);
// wait until the login process is completed
// fetch session key
String session = client.auth_getSession(token, true);
......

我想把它改成基于网络的。

为什么你不能这样做:

String sessionKey = request.getParameter(FacebookParam.SESSION_KEY.toString());

FacebookXmlRestClient client = new FacebookXmlRestClient(FB_API_KEY, FB_SECRET_KEY, sessionKey);
我还建议并描述有关生成会话密钥的信息。我想这会对你有帮助