facebook - Facebook4J support for exchanging access-tokens -


i'm looking way exchange short-lived access tokens long-lived access tokens in our backend described facebook here. how facebook4j?

i have done exchange old token new token:

private accesstoken refreshtoken(facebook facebook, accesstoken currenttoken) throws exception {     string clientid = configuration.getstring(configurationkeys.social_facebook_clientid);     string clientsecret = configuration.getstring(configurationkeys.social_facebook_clientsecret);      map<string, string> params = new hashmap<string, string>();     params.put("client_id", clientid);     params.put("client_secret", clientsecret);     params.put("grant_type", "fb_exchange_token");     params.put("fb_exchange_token", currenttoken.gettoken());      rawapiresponse apiresponse = facebook.callgetapi("/oauth/access_token", params);      string response = apiresponse.asstring();     accesstoken newaccesstoken = new accesstoken(response);      facebook.setoauthaccesstoken(newaccesstoken);      return newaccesstoken; } 

i think can done after each login access token refreshed if still valid - newer token 60 days of validity.

what think?


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -