Authentication

To work with Facebook Instant Articles REST API you need to have valid access token. Bundle provides controller for authentication url generation and handling authorization callback requests from Facebook.

Authorization procedure requires providing Facebook Application and Page (token will be generated for that combination) ID’s. Bundle provide entities for both (Application and Page) and will look for matching rows in database.

Note

Authentication controller checks if provided page and application are in your storage (database). But bundle doesn’t provide controllers for adding them (there are only pre-configured factories and repositories) - You need to implement it manually in your application.

Authentication flow

Assuming that in your database you have Application with id 123456789 and Page with id 987654321 (and both it exists on Facebook platform), You need to call this url (route: swp_fbia_authorize): /facebook/instantarticles/authorize/123456789/987654321

In response You will be redirected to Facebook where You will need allow for all required permissions.

After that Facebook will redirect You again to application where (in background - provided by Facebook code will be exchanged for access token and that access) you will get JSON response with pageId and accessToken (never expiring access token).