Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 24, 2015 @ 11:31
    Ismail Mayat
    0

    Facebook me posts

    Anders,

    Using all the latest skybrud social and i can get facebook page stats for a given user.  What is not working however is 

    return _facebookService.Posts.GetPosts("me", noOfPosts).Body.Data;            

    What I am trying to do is for the currently authenticated facebook user get their latest posts.  I get error 

    An active access token must be used to query information about the current user.

    The token is active in that it lets me get data for other users, just will not let me get data for current user? It used to work with old version of skybrud. Any ideas?

    Regards


    Ismail

  • Anders Bjerner 487 posts 2989 karma points MVP 7x admin c-trib
    Feb 24, 2015 @ 11:57
    Anders Bjerner
    0

    Hi Ismail,

    It should still work, but I will check if there is a bug in the latest code.

    How have you obtained the access token? If you have used the login dialog in my package, you have obtained what is called a user access token, and it should work fine. If you have obtained the access token in another way, you may have an app access token instead, and you can't use "me".

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 24, 2015 @ 12:06
    Ismail Mayat
    0

    Anders,

    I obtained the token using https://developers.facebook.com/tools/accesstoken/ the reason for this was because user access token expires after 60 days i think, weird thing is this used to work fine with old version of skybrud.  With the token i need to do both getting other users page stats (works fine) and current users latest posts, this is failing.

    Regards

    Ismail

  • Anders Bjerner 487 posts 2989 karma points MVP 7x admin c-trib
    Feb 24, 2015 @ 18:36
    Anders Bjerner
    0

    Hi Ismail,

    Are you sure you're not using an app access token?

    The access token page will list a user access token and an app access token for each of your apps.

    • The user access token is bound to your user, and therefore has a user context (means that you can use "me"). The downside is that the token will expire after 60 days.

    • The app access token is bound to your app, and therefore doesn't have a user context (means that you can use "app" rather than "me" - which is not the same). App access tokens will not expire, so it seems this is what you're using?

    I'm pretty sure the logic regarding this hasn't changed in Skybrud.Social. At least it still works when I test using few of the user access tokens listed on the page.

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 25, 2015 @ 09:42
    Ismail Mayat
    0

    Anders,

    Yes it is an app access token, do i then need to have 2 one user access one so i can get current users posts and one app token so i can othe users pages data?  My one concern is that the user one expires after 60 days is there another way round this?

    Regards

    Ismail

  • Anders Bjerner 487 posts 2989 karma points MVP 7x admin c-trib
    Feb 25, 2015 @ 10:16
    Anders Bjerner
    100

    Here is what I would do:

    • Go to the Graph API Explorer and enter the user access token listed for your app at the access token page. Then make a call to /me, and manually read the ID of your user (and then hardcode it in your code or something like that).

    • In your code, then use the app access token (again from the access token page) to make requests to the API.

    Users have unique IDs from app to app, so it is important that both the user access token and the app access token belongs to the same app. Facebook does this to protect the privacy of their users.

    Anyways, if possible, I would suggest creating a page instead. Pages are easier to work with in the API - among other things because pages have global IDs (the same across all apps), and you can give a page an alias (eg. you can call /umbraco/posts).

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 25, 2015 @ 10:36
    Ismail Mayat
    0

    Anders,

    Doh of course KISS keep it simple stupid lol, I am certain that the posts we want are from facebook user with page its for a big company. So I will do that.

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Feb 25, 2015 @ 10:40
    Ismail Mayat
    0

    Anders,

    That works a treat many thanks once again.

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft