Skip to content

Commit 988b60e

Browse files
committed
Adding getter for app id and app secret. Adding example how to publish on users feed using app credentials.
1 parent 25c4e45 commit 988b60e

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ Or if have a valid access token for instance from javascript fb connect
5757
fb.me(function(err, me) {
5858
console.log(me);
5959
});
60+
61+
Or do stuff on behalf of the app or user with granted permissions
62+
63+
var fb = new fbgraph.Facebook(fbgraph.getAppId() + '|' + fbgraph.getAppSecret());
64+
fb.post('/{user-id}/feed', {message: 'Hello world'},function(err, res) {
65+
console.log(err, res);
66+
});
6067

6168
Or just accessing public data
6269

@@ -87,6 +94,12 @@ This method will redirect user to Facebook login form.
8794
### destroySession(req, res, clearCookie)
8895
This method is for logging out user or for any reason want to clear user's logged-in info
8996

97+
### getAppId()
98+
return app id, set via auth()
99+
100+
### getAppSecret()
101+
return app secret, set via auth()
102+
90103
## Classes
91104
### Facebook(accessToken)
92105
* `accessToken` Valid access token from Facebook (oauth_token).

lib/facebook.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ module.exports.auth = function(config) {
7676
return authenticate;
7777
};
7878

79+
80+
var getAppId = module.exports.getAppId = function() {
81+
return appId;
82+
};
83+
84+
var getAppSecret = module.exports.getAppSecret = function() {
85+
return appSecret;
86+
};
87+
7988
var redirectLoginForm = module.exports.redirectLoginForm = function(req, res) {
8089
var state, currentUrl, query;
8190

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
"url": "https://github.com/vanng822/facebook-nodejs/blob/master/LICENSE"
2424
}
2525
],
26-
"version": "0.4.7"
26+
"version": "0.4.8"
2727
}

0 commit comments

Comments
 (0)