How to get facebook session key with facebook-java-api
How do I get the session key with the facebook-java-api ?# What I did so far is this :
After I authorised my app to acces my facebook account I do get redirected to the right redirect url in my app and there I do
FacebookJsonRestClient facebookClient = new FacebookJsonRestClient ('key', 'secaret')
String token = facebookClient.auth_createToken()
With the returned token I try to get the session key
def sessKey = facebookClient.auth_getSession(token)
But the ends up in :
errors.GrailsExceptionResolver JSONObject["session_key"] not found. org.json.JSONException: JSONObject["session_key"] not found. 开发者_StackOverflow中文版 at org.json.JSONObject.get(JSONObject.java:498) at org.json.JSONObject.getString(JSONObject.java:669) at com.google.code.facebookapi.ExtensibleClient.auth_getSession(ExtensibleClient.java:288) at com.google.code.facebookapi.ExtensibleClient.auth_getSession(ExtensibleClient.java:274)
What am I missing here ? The documentation is no help at all. Javadocs also is no help at all. Is someone out there who can recommend me a java library to use for facebook access ?
That library is very outdated. I would recommend switching to RestFB. If you go to their site they have tons of examples.
Try the below line of code:
string Session_Key=Request.QueryString.Get("fb_sig_session_key").ToString();
精彩评论