Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB server-side login to Post to Page : secret key vs access token #138

Open
ksteinberg opened this issue Jul 2, 2018 · 0 comments
Open

Comments

@ksteinberg
Copy link

** dislaimer: apologies for any neophyte like statements or comments. I have not coded server-side auth before ***

Goal: Using nodejs to post to a FB page I own/admin.

NOT using user accounts or validations. I have setup the the app in the FB developers portal. I have my app id, secret key, and client access token. /Ptpage is just a page I created to post to as opposed to /feed.

Sample code and result below, data changed to protect the innocent.
I feel like this should work and that perhaps I do not have my FB app set up correctly so I have two questions:

  1. is this code wrong? I don't want a client app popping up to login. This is a background thread that does not have access to the user.

  2. Has anyone done this recently and if so, how have you configured your FB app? THere are a few Advanced boolean settings that could go either way, IMO.


var graph = require('fbgraph');
var fbkeys = {
fbAppId : 630638811632665,
fbSecret : '17028918c9fb193be68062c455f14750'
};
graph.setAccessToken(fbkeys.fbAppId|fbkeys.fbSecret);

var wallPost = {message:"hi"};
var pg = "9129436374229947" + "/Ptpage";
graph.post(pg,wallPost, function(err,res){
if(err){
console.log(err);
}
console.log(res);
});

Executing this nets me this resulting error code:

type: 'OAuthException',
code: 190,
fbtrace_id: 'GDdkoaDUie8' }
{ error:
{ message: 'Invalid OAuth access token.',
type: 'OAuthException',
code: 190,
fbtrace_id: 'GDdkoaDUie8' } }

Thanks
Ken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant