Skip to content

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

@ksteinberg

Description

@ksteinberg

** 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions