javascript - Facebook graph api call to get app access token returns "unknown error" -
i building web app integrating facebook. have on facebook app id , app secret already.
i'd use javascript retrieve app's access token make further app-to-user app requests. i'm following instructions here
however, not make fb.api call working. tried
fb.api('https://graph.facebook.com/oauth/access_token','get', {client_id:'xxxxx', client_secret:'xxxxx',grant_type:'client_credentials'}, function(response) { alert(json.stringify(response)); }); and
fb.api("/oauth/access_token?client_id=xxxxxx" + "&client_secret=xxxxxxxx&grant_type=client_credentials", function(response) { alert(json.stringify(response)); }); but {"error":{"type":"http","message":"unknown error"}}
do use fb.api incorrectly? @ time, not find further documentation showing did wrong.
on other hand, can manually request browser url like: https://graph.facebook.com/oauth/access_token?client_id=xxxxx&client_secret=xxxxxx&grant_type=client_credentials
so, missing in code? lot help.
you dont need expose app secret. instead can use app token directly in calls (app token not expire until reset secret key).
facebook documentation reference link access tokens , types
have fun!!!
regards, hbk
Comments
Post a Comment