开发者

How to authenticate Facebook user without form?

Is there any way I can authenticate a Facebook user without requiring them to connect in the front end? I'm trying to report the number of "likes" for an alcohol-gated page and will need to access the information with an over-21 access token, but do not want to have to log in every time I access开发者_开发百科 the data.

Or is there a way to generate an access token that doesn't expire?

I'm really not that much of an expert with facebook, so any alternatives to these ideas would be greatly appreciated.


When you're requesting the access token you're going to use to check the Page, request the offline_access extended permission and the token won't expire when you/the user logs out.


If you're using the Graph API, when you initially get the access_token, add offline_access to the list of permissions you're requesting via the scope parameter. From the permissions documentation:

The set of permissions below basically explain what types of permissions you can ask a u ser in the scope parameter of your auth dialog to get the permissions you need for your app.

So add offline_access to the permissions you're requesting in the scope parameter:

$config = array(
  ...
  "scope" => "offline_access,...",
  ...
);
...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜