roughike/flutter_facebook_login

Get a page access token

Closed this issue · 1 comments

All right, I can get the user access token, but how can I get a page access token?

Answering my own question, you can get the access token for a page that user own from a call to the graph as follow:

final facebookLogin = FacebookLogin();
final resp = await facebookLogin.logIn([
   'pages_show_list',
   'pages_read_engagement',
]);

final graphResponse = await http.get("https://graph.facebook.com/${resp.accessToken.userId}/accounts?access_token=${resp.accessToken.token}");