Search code examples
facebookfacebook-graph-apifacebook-php-sdk

Facebook Graph API: get link to users timeline doesn't work


I want to get the link to persons timeline who granted my app access.

So in the reference for the user (https://developers.facebook.com/docs/graph-api/reference/v2.7/user) - i know it's outdatet version but it should still work - I can see the "link" field which gives me "A link to the person's Timeline" as the documentation says.

So when I am doing this, I get a link with the following format:

https://www.facebook.com/app_scoped_user_id/YXNpZADpBWEVoMWtvWEVtYTM3RFBkS3dYQVdWMUNwMVRJMzNWeko4aF83eFpQU05jcXByTXJwVmFoS293a1FMSWlKNFpibTNmbFpGa04wOUh5bmlWc3ZAKV3ZAWeEt2MEFBYlljb2JWNHRMTDRSY1FybFNyNDNpU3cZD/ (it's a really long URL which is generated by facebook)

So far so good. But when I click on this URL which facebook gives me, I always get a Facebook Page with the content "Sorry, this content isn't available right now" (as you can see when you click on the link above).

I don't know what the problem is. Since a facebook profile isn't callable with the user-id I have this problem.

Does anybody know how to fix it and get a working link to the users timeline?

Thanks!


Solution

  • You need to ask for the new user_link permission now first, to be able to get a working link that will lead to a persons timeline.

    https://developers.facebook.com/docs/facebook-login/permissions/#reference-user_link

    (The returned URLs seem to contain a cryptic token rather than an actual user id, so you should not store them for long-term usage, they will likely expire over time.)