Nick
Nick

Reputation: 1331

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.

Upvotes: 1

Views: 132

Answers (2)

jches
jches

Reputation: 4527

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,...",
  ...
);
...

Upvotes: 0

Igy
Igy

Reputation: 43816

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.

Upvotes: 3

Related Questions