facebook connect: read Page stream without being logged in
I'm using the facebook developer's toolkit for a facebook connect website. The website posts content to the stream for a page - which I have working fine.
I'd like to also get the stream from the page to show users who visit the website - regardless if they are logged in to facebook or not. Facebook provides a handy fan box (fbml) for this, but the big problem here is that it only shows the stream for items posted by the page, not items posted by fans. I of course need to show content posted by fans and well as the page.
So, I've been going around in circles trying to figure out 开发者_StackOverflow中文版how to do this, with no luck. It seems I need to grant read_stream permissions to my application, not to a specific user. I'm not sure where / how I go about doing this!
Thanks.
I finally found the solution.
Dim dict As New Dictionary(Of String, String)
dict.Add("method", "facebook.stream.get")
Utilities.AddOptionalParameter(dict, "viewer_id", userIdToImpersonate)
Utilities.AddList(dict, "source_ids", pageIds)
Dim fbSession As New ConnectSession(ConfigurationManager.AppSettings("Facebook_Key"), ConfigurationManager.AppSettings("Facebook_Secret"))
Dim api As New Facebook.Rest.Api(fbSession)
Dim resp As stream_get_response = api.SendRequest(Of stream_get_response)(dict, True)
I sorted this out using Reflector on the Facebook Developers Toolkit api. The Facebook.Rest.Stream.Get method should have worked, but was throwing exceptions, so I used this base call instead.
精彩评论