facebook - Trying to get an access token using restFB. but not directing -


hello i'm playing spring boot , learning web services. started playing facebook graph api , using restfb. access token , hard code every time. dont want hard code credentials(access tokens), want able token when sign in account without hard coding access tokens every time try retrieve photos face , use in application. has worked restfb show me example of how automatically access tokens without hard coding it. thanks. uri "localhost:8080/myapp."

@controller @requestmapping("/") public class homecontroller {    @value("#{facebookappid['app_key']}")   private static string app_key;   @value("#{facebookappsecret['secret']}")   private static string app_secret;    private facebookclient.accesstoken getfacebookusertoken(string code, string url) throws ioexception {    webrequestor web = new defaultwebrequestor();    webrequestor.response accesstokens = web.executeget("https://graph.facebook.com/oauth/access_token?client_id="+    app_key+url+"&client_secret="+app_secret+"&code=" + code);       return     defaultfacebookclient.accesstoken.fromquerystring(accesstokens.getbody());  }        @requestmapping(method= requestmethod.get)       public string hellofacebook(model model) {          string url = "https://www.facebook.com/dialog/oauth?"+app_key;         return "redirect"+url;     }    } 

you can use obtainuseraccesstoken defaultfacebookclient facebookclient facebookclient = new defaultfacebookclient(version.version_2_2); facebookclient.obtainuseraccesstoken(appid, appsecret, redirecturi, verificationcode);


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -