FB.api('/me') always giving error code:2500 in phonegap android

大憨熊 提交于 2019-12-02 11:04:38

You need access token to retrieve more details than basic user information. Check that whether you have correct access token in Debug Tool to and ensure that you have all require permissions set permission.

Problem solved after changing the "session" in 'getResponse' method in ConnectPlugin to "authResponse"

FB.api method is working fine for me to get the user details and post a feed to the facebook after I change the following method in ConnectPlugin.java as following.

  public JSONObject getResponse() {
    String response = "{" + "\"status\": \""
            + (facebook.isSessionValid() ? "connected" : "unknown") + "\","
            +
            // "\"session\": {" + "\"access_token\": \""
            // + facebook.getAccessToken() + "\"," + "\"expires\": \""
            // + facebook.getAccessExpires() + "\","
            // + "\"session_key\": true," + "\"sig\": \"...\","
            // + "\"uid\": \"" + this.userId + "\"" +

            "\"authResponse\": {" +

            "\"accessToken\": \"" + facebook.getAccessToken() + "\"," +

            "\"expiresIn\": \"" + facebook.getAccessExpires() + "\"," +

            "\"session_key\": true," +

            "\"sig\": \"...\"," +

            "\"userId\": \"" + this.userId + "\"" +

            "}" + "}";

    try {
        return new JSONObject(response);
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return new JSONObject();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!