This is an example that using nodejs to get the user token form facebook. And this project use es6, you need npm install
to install repo dependencies.
這是一個fb-api的範例,使用nodejs後端向Facebook要求使用者的token,當獲取token之後,就可以做後續的資料處理、發文.....等等。因為此專案使用es6,執行程式前需執行npm install
安裝相依性套件。
Facebook for Developers says Your app secret should never end up in client code
. So you need to create a key.json file.
key.json
{
"client_id": [The App client id],
"client_secret": [The App client secret],
"scope": [the Facebook scope]
}
Facebook-dev上寫著應用程式密鑰絕不能出現在用戶端程式碼中
,所以執行前必須建立設定檔key.json
在專案根目錄中。
key.json
{
"client_id": Facebook應用程式的client_id,
"client_secret": Facebook應用程式的client_secret,
"scope": 需要Facebook的權限
}
node main.js
node main.js