Ricardo Gomes
Ricardo Gomes

Reputation: 1266

Can we access Facebook Graph API via script

I'm trying to create a simple script (node) that each day collects information from various APIs, including Facebook's Graph API.

The idea is simple, each day I want to collect the total friend count of my personal account, total page likes of my managed pages, total social interactions of my content (personal and from pages).

Now, if I was doing this in a web app, the normal route would be using facebook login to request the access tokens for my profile and pages, but since this is a script it does not have a public exposed url to return the authentication to.

Does anyone know of a way to manually get the tokens, to use in a scenario like this?

Thanks

Upvotes: 0

Views: 546

Answers (1)

Philip O'Brien
Philip O'Brien

Reputation: 4266

Have you tried to use this node package?

If you get an accesstoken via some other Oauth module like everyauth , connect-auth or node-oauth you can just set the access token directly. Most get calls, and pretty much all post calls will require an access_token

There is also a decent article on Medium which works through this process.

Upvotes: 1

Related Questions