tags:

views:

146

answers:

0

I'm trying to publish to a Facebook Stream using the Facebook Developer Toolkit v3 but I keep getting this error:

A session key must be specified when request is signed with a session secret

What I want is just to post a link using the more detailed Publish method.

My code looks like this:

First I setup a DesktopSession like this:

private static List<Enums.ExtendedPermissions> SetupPerms()
{
    var perms = new List<Enums.ExtendedPermissions>();
    perms.Add(Enums.ExtendedPermissions.read_stream);
    perms.Add(Enums.ExtendedPermissions.publish_stream);
    perms.Add(Enums.ExtendedPermissions.offline_access);
    return perms;
}

...

List<Enums.ExtendedPermissions> perms = SetupPerms();
_Session = new DesktopSession(ApplicationKey, SessionKey, SessionSecret, false, perms);
_Session.Login();

Then I publish like this:

var attachProp = new attachment_property_value();
attachProp.href = "prophref";
attachProp.text = "proptext";
var prop = new attachment_property { name = "propname", value = attachProp };

List<attachment_property> props = new List<attachment_property>();
props.Add(prop);

attachment attach = new attachment() {   caption = "Caption", 
                                             href = "prefix://abc/1234", 
                                             name = "Name", 
                                             description = "Description", 
                                             properties = props };

List<action_link> links = new List<action_link>();
links.Add(new action_link() { href = "actionlinkhref", text = "actionlinktext" }); 

_Api.Stream.Publish("This works!");
_Api.Stream.Publish("But this doesn't...", attach, links , null,_Session.UserId);

Thanks in advance.