stream.publish to Page

Sep 28, 2009 at 10:26 AM

I'm trying to use stream.publish to push status updates to a page.  I downloaded the latest version and changed uid from int to ulong to solve that problem but I have an authentication issue.

I've granted my app rights to publish for my page via prompt_permissions.php, but when I try to post an update as the page I get an "Incorrect signature" error.  It works ok as a fan of the page, but not when I post as the page i.e.

api.stream.publish(notification.Message, null, null, pageId.ToString(), pageId);

Any ideas?

Oct 1, 2009 at 10:00 PM

I have a a desktop app that auths fine but when publishing, it executes the code without exception but there is no post on the web.

'No Exception - No Post
facebookService1.API.stream.publish("Test Stream publish", Nothing, Nothing, _groupID.ToString, Nothing)

'No Exception - No Post
facebookService1.API.stream.publish("Test Stream publish", Nothing, Nothing, _pageID.ToString, Nothing)

'No Exception - Post
facebookService1.API.stream.publish("Test Stream publish", Nothing, Nothing, facebookService1.uid.ToString, Nothing)

I also added perms for offline_access, status_update, and publish_stream

<font size="2">

phatcher - have you tried using pageId as target with a null reference to uid?

</font>

 

Oct 6, 2009 at 8:18 PM

I have noticed that the following occurs:

Dim secret1, secret2 as String
secret1 = "<secret>"
facebookService1.secret = secret1
facebookService1.ConnectToFacebook()
secret2 = facebookService1.secret

'secret1 does not equal secret2

It appears that secret2 comes from api.auth.getSession

I have not a clue if this is supposed to be this way, but I certainly assume the secret is to remain the same.  Any glimmer of hope for this?

Oct 6, 2009 at 8:27 PM

With a null uid then it works, i.e. posts, but does it as the application rather than the page itself which is what I'm after.

I think I need to have a look at what's being sent to see what's going on.

Oct 13, 2009 at 4:45 PM

I have had no success posting at all.  I have used Seesmic Desktop (seesmic.com) and have posted as the app which is what I want.  When I do

<font size="2">

.API.stream.publish("Test Post", Nothing, Nothing, _pageID.ToString, Nothing) I have no failure, but no post as well.  Do you know if I am missing something obvious?

</font>

 

Nov 8, 2009 at 6:23 AM

I've found the cause of this issue but haven't yet dissected the best solution. The appropriate call is:

api.Stream.Publish(messageToSend, null, null, null, userIdOfYourPage);

However, you must use a session key, not the application key. The toolkit code doesn't pass the session key, though, when you use a pageId:

In Stream.cs:

var response = SendRequest<stream_publish_response>(parameterList, uid <= 0);

The uid will be > 0, returning a false for the useSession parameter. If I step through the code, and flip the value to true via the Locals window, it will successfully post to the Page as the Page itself.

I'll see how to modify the Stream code and submit a patch.

Nov 8, 2009 at 4:05 PM

After a night's sleep and some more reading. The FB Api states the following about session_key:

The session key of the logged in user. The session key is automatically included by our PHP client. This is only required if you don't specify a uid, or if a desktop application calls stream.publish.

The last part is the important part. If you are making the call from a desktop application you have to specify the session_key - even if you are using a uid. So I modified the code as follows:

Stream.cs in the private Publish method:

            // Per API documentation:
            // [session_key] is only required if you don't specify a uid, or if a desktop application calls stream.publish.
            var useSession = uid <= 0 || Session is DesktopSession;

if (isAsync)
{
SendRequestAsync<stream_publish_response, string>(parameterList, useSession, new FacebookCallCompleted<string>(callback), state);
return null;
}

var response = SendRequest<stream_publish_response>(parameterList, useSession);

Since the SVN repo is not working right now (per other threads) I cannot submit a patch.

Nov 9, 2009 at 3:59 PM

Since I use a desktop application, I modified the SendRequest to use the session.  However, now I get a Permissions Error.  I have offline_access, status_update, and publish_stream extended permissions set.  The page I am trying to post to as the page is logged in as the administrator of the page.  Is there something else I need to change?

Nov 9, 2009 at 4:24 PM

Can you post your call to publish? Are you using your Page's ID in the uid parameter?

Also, what permissions show up when you go to the Page's Application permissions on Facebook? It should show "Publish to streams".

Nov 9, 2009 at 4:37 PM

My Call is:

_fbServ.API.stream.publish(Me.rtbPost.Text.Trim, Nothing, Nothing, _pageID.ToString, _pageID)

[MyApp] has permission to:

“CHECKED” Publish recent activity (one line stories) to my wall

The only other change I have made to the library is copy/paste the stream.publish function and changing the uid from int to long.

From: brianromanko [mailto:notifications@codeplex.com]
Sent: Monday, November 09, 2009 10:25 AM
To: Web
Subject: Re: stream.publish to Page [FacebookToolkit:70312]

From: brianromanko

Can you post your call to publish? Are you using your Page's ID in the uid parameter?

Also, what permissions show up when you go to the Page's Application permissions on Facebook? It should show "Publish to streams".

Read the full discussion online.

To add a post to this discussion, reply to this email (FacebookToolkit@discussions.codeplex.com)

To start a new discussion for this project, email FacebookToolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Nov 9, 2009 at 4:46 PM

The version of the code located in the DEV folder actually has the long changes already made (and the DesktopSession class). This is the version I am working against. There might be some other abnormalities with the 2.0 code that I'm unaware of.

One thing I noticed from your call is that the fourth parameter should be null.

Nov 9, 2009 at 4:52 PM

Oh. The extended permissions are incorrect. the checkbox should read "Publish to streams" exactly. The ONLY way to get this permission to show is to manually enable it for a desktop app is to visit the extended permissions page in your browser. If you've enabled offline_access, you'll only need to do this one time. I just created a url and then visited the URL. Once you've done that, the permission should change from what you are seeing to "Publish to streams".

http://wiki.developers.facebook.com/index.php/Extended_permission

"By directing them to the URL: http://www.facebook.com/connect/prompt_permissions.php. Desktop applications can use this method only to prompt for permissions. For information on formatting this URL, read Authorization and Authentication for Desktop Applications."

Build up your URL using the parameters from here: http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Desktop_Applications#Prompting_for_Permissions

Make SURE to set enable_profile_selector to 1. This will put a drop down in the dialog allowing your to select your page. Not doing this will just apply those permissions to your personal account.

- Brian

Nov 9, 2009 at 5:27 PM

Im downloading 38617 and will go from there. 

From: brianromanko [mailto:notifications@codeplex.com]
Sent: Monday, November 09, 2009 10:46 AM
To: Web
Subject: Re: stream.publish to Page [FacebookToolkit:70312]

From: brianromanko

The version of the code located in the DEV folder actually has the long changes already made (and the DesktopSession class). This is the version I am working against. There might be some other abnormalities with the 2.0 code that I'm unaware of.

One thing I noticed from your call is that the fourth parameter should be null.

Read the full discussion online.

To add a post to this discussion, reply to this email (FacebookToolkit@discussions.codeplex.com)

To start a new discussion for this project, email FacebookToolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Nov 9, 2009 at 7:47 PM

The new version (most likely) and building the URL link (most def) got me going.  I appreciate the help!

From: bjstuhlsatz [mailto:notifications@codeplex.com]
Sent: Monday, November 09, 2009 11:28 AM
To: Web
Subject: Re: stream.publish to Page [FacebookToolkit:70312]

From: bjstuhlsatz

Im downloading 38617 and will go from there.

From: brianromanko [mailto:notifications@codeplex.com]
Sent: Monday, November 09, 2009 10:46 AM
To: Web
Subject: Re: stream.publish to Page [FacebookToolkit:70312]

From: brianromanko

The version of the code located in the DEV folder actually has the long changes already made (and the DesktopSession class). This is the version I am working against. There might be some other abnormalities with the 2.0 code that I'm unaware of.

One thing I noticed from your call is that the fourth parameter should be null.

Read the full discussion online.

To add a post to this discussion, reply to this email (FacebookToolkit@discussions.codeplex.com)

To start a new discussion for this project, email FacebookToolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (FacebookToolkit@discussions.codeplex.com)

To start a new discussion for this project, email FacebookToolkit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jul 19, 2010 at 2:06 AM
hi everyone, please,who can write the last form of the code? i'm trying to create a photo album in my fan page,but i couldn't do it :( please help me
Jul 19, 2010 at 11:35 AM
by the way, i'm trying to update a fan page....can i do it with the facebook .NET api?
Aug 10, 2010 at 7:32 AM
phatcher wrote:

I'm trying to use stream.publish to push status updates to a page.  I downloaded the latest version and changed uid from int to ulong to solve that problem but I have an authentication issue.

I've granted my app rights to publish for my page via prompt_permissions.php, but when I try to post an update as the page I get an "Incorrect signature" error.  It works ok as a fan of the page, but not when I post as the page i.e.

api.stream.publish(notification.Message, null, null, pageId.ToString(), pageId);

Any ideas?

 Hi All,

Here is the solution to publish as a fan not as a user.

api.stream.publish(notification.Message, null, null, null,pageId);

Thanks,

Ibrahim.

Aug 11, 2010 at 9:24 AM
ibrahimkhan wrote:
phatcher wrote:

I'm trying to use stream.publish to push status updates to a page.  I downloaded the latest version and changed uid from int to ulong to solve that problem but I have an authentication issue.

I've granted my app rights to publish for my page via prompt_permissions.php, but when I try to post an update as the page I get an "Incorrect signature" error.  It works ok as a fan of the page, but not when I post as the page i.e.

api.stream.publish(notification.Message, null, null, pageId.ToString(), pageId);

Any ideas?

 Hi All,

Here is the solution to publish as a fan not as a user.

api.stream.publish(notification.Message, null, null, null,pageId);

Thanks,

Ibrahim.

 And also

use this link for giving access to your fanpage to post as fan to all users. Replace apikey and pageid with your apikey and page values
http://www.facebook.com/connect/prompt_permissions.php?api_key=apikey&v=1.0&next=http://www.facebook.com/connect/login_success.html?xxRESULTTOKENxx&display=popup&ext_perm=publish_stream&enable_profile_selector=1&profile_selector_ids=pageid

Once you give the permission you will get success message. Then try my code.

Thanks,

Ibrahim.

Nov 28, 2010 at 4:55 PM

Hi,

I am still working on posting to fan page wall. I can not publish stream using winform. Is this a general problem, is it going on? Could you please help me about that?

Exception message: A session key must be specified when request is signed with a session secret. I tried all suggestions on forums. But It doesnt.

Thank you.