0

I have used the following code to get extended access token for my Facebook application but this gives exception as

IllegalArgumentException: Was expecting a query string of the form 'access_token=XXX' or 'access_token=XXX&expires=YYY'. Instead, the query string was '{"access_token":"xxxx","token_type":"bearer","expires_in":5180464}'

Please help

package extendtoken;

import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.FacebookClient.AccessToken;

 /**
 *
 * @author shripadm
 */
public class Extendtoken {

 /**
 * @param args the command line arguments
 */
 public static void main(String[] args) {
   String accessToken="XXXX";
   String AppId="YYYY";
   String AppSecret="ZZZZ";

   FacebookClient fbClient= new DefaultFacebookClient(accessToken);


    AccessToken exAccessToken= fbClient.obtainExtendedAccessToken(AppId,        AppSecret, accessToken);

     System.out.println(exAccessToken.getAccessToken());
     System.out.println(exAccessToken.getExpires());
  }

 }
  • Possible duplicate of [facebook graph api not work from 2.2 to 2.3](http://stackoverflow.com/questions/42994019/facebook-graph-api-not-work-from-2-2-to-2-3) – CBroe May 17 '17 at 10:51
  • The format the access token is returned in has changed between API v2.2 and v2.3, see the linked duplicate. Go look for updates to the packages you are using that take this change into account. – CBroe May 17 '17 at 10:52
  • please check the RestFB version, it looks like you are using an old one. ATM 1.41.0 is the newest – Norbert Jun 01 '17 at 14:08

0 Answers0