Using Facebook Javascript SDK to get Graph Data -
Using Facebook Javascript SDK to get Graph Data -
fixed now! can't reply own question yet. see comment below. , helping.
i've searched , searched , read docs , still can't figure out.
i have web page event. there's public facebook "event" event. i'm trying utilize fb javascript sdk number of attendees facebook event , add together number of people who've registered through website.
i've created app , have appid , secret string. can access token from:
https://graph.facebook.com/oauth/access_token?client_id=xxxx&client_secret=xxxxx&grant_type=client_credentials
and can utilize access token attendees public event:
https://graph.facebook.com/331218348435/attending?access_token=xxxxxxxxx
that's fine.
i'm trying same thing using javascript sdk.
i've loaded sdk , done init:
fb.init({ appid : 'xxxxxxxx', status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse xfbml }); and know sdk working because can object info doesn't need access token:
fb.api( '/331218348435', function (response) { console.log ( response ) } ); but when seek attendee info needs access token:
fb.api( '/331218348435/attending', function (response) { console.log ( response ) } ); i oauthexception: "an access token required request resource."
all tutorials , info can find refers using .login method, don't want user login, want login using app id without user interaction.
i'd assumed api took sdk's init request , granted me access token when called .init method, authentication beingness done against website's address (the http referrer - yes have set website url in facebook app settings).
any ideas might causing not work? how can access token using javascript sdk without doing .login? missing step? possible?
thanks
form rather circular documentations says, getting attending feed requires 'generic access_token`. in facebook terms:
any valid access_token valid access token returned our apis. access token may not valid if, example, has expired. no special permissions required. occasionally, referred generic access_token.
so means can utilize token access attending feed, long event public. easiest access token seems app token: http://developers.facebook.com/docs/authentication/#applogin. can token using app id , secret, , no user interaction required.
to summerise link content: can application access token sending request to
https://graph.facebook.com/oauth/access_token?client_id=your_app_id&client_secret=your_app_secret&grant_type=client_credentials you can utilize access_token create phone call attending list
fb.api('myevent/attending?access_token=access_token'); javascript facebook sdk facebook-graph-api access-token
Comments
Post a Comment