Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 1265 posts 3834 karma points admin c-trib
    Apr 23, 2020 @ 22:01
    Dan
    0

    Get Facebook posts of page owned by authenticated user using Skybrud.Social

    Hi,

    I have an Umbraco 7 site running Skybrud.Social 1.0.7. I've added the Facebook auth data-type to the site and have successfully authenticated against my own personal facebook account.

    Now, I'm doing the following in a Razor view to use the authentication credentials to pull a list of posts from my facebook profile and output them on a page:

    FacebookOAuthData facebook = ContentHelpers.WebsiteNode().GetPropertyValue("connectToFacebook") as FacebookOAuthData;
    FacebookPostsResponse response = service.Posts.GetPosts(new FacebookGetPostsOptions
    {
        Identifier = "me",
        Fields = "id,name,message,story,created_time,picture,link,description",
        Limit = 25
    });
    
    foreach (FacebookPost post in response.Body.Data)
    {
        <p>Id: @post.Id</p>
    }
    

    So far so good. This works great.

    However, what I need to be able to do is pull posts from a different page under my Facebook account (e.g. the kids' football team page I manage). I've tried modifying the identifier to use the page name or the page id from Facebook but when I do this I receive an error:

    Skybrud.Social.Facebook.Exceptions.FacebookException: (#100) Pages Public Content Access requires either app secret proof or an app token
    

    Incidentally, it's the same error if I use the Skybrud methods to get the page object too, not just the posts. I can get all of my direct details fine, but when I try to cross over to my other pages' details, it errors.

    I've looked into this error but it's pointing me in the direction of having to include an access token along with the request, but I'm finding this confusing now and am hitting a roadblock.

    Can anyone suggest how to get the posts from a specific page under my facebook account?

    Many thanks for any pointers.

  • Amir Khan 1263 posts 2674 karma points
    Apr 23, 2020 @ 23:01
    Amir Khan
    0

    This is likely not the answer you're looking for...but as social APIs have become a pain to update, have you looked at something like http://juicer.io/.

    Its super cheap and we use it for a handful of sites.

  • Dan 1265 posts 3834 karma points admin c-trib
    Apr 24, 2020 @ 08:38
    Dan
    0

    Thanks Amir. I have considered this kind of service but they're not a good fit for this project unfortunately.

Please Sign in or register to post replies

Write your reply to:

Draft