function authGraphCall(path, token, cb) { var url = string.format(fbgraphFormat, path, token) ajax.get( url , function (data, res) { cb(JSON.parse(data)); } , function () { console.trace("error in authgraphcall"); cb({error:"Error calling fb"}) } ); }
this.getServerAccessTokenUrl = function (redirectPath, code, callback) { // todo, these configs should be passed in var redirecturi = "http://" + global.config.FB.host + redirectPath var fbtokenpath = fbgraph + "/oauth/access_token?" + "client_id=" + global.config.FB.appid + "&redirect_uri=" + encodeURIComponent(redirecturi) + "&client_secret=" + global.config.FB.secret + "&code=" + code; function done(data, res) { data = data ? data : null; callback(data); } ajax.get( fbtokenpath, done, done ); }