开发者

Facebook real-time user updates

When using the Facebook real-time callbacks to update user settings/details, are you able to access a users details even without a never ending token?

Realistically, we don't want to have to ask users for offline access, but still want to be able to update their details in our system.开发者_运维百科 Is it possible to do this, or do you have to require offline access, or mark it to be updated whenever the user next visits?


If you want to access publicly available data, you can simply get it like this: https://graph.facebook.com/{User_ID}

If you want the response to also include the extended permissions that you received from the user, you can first get your app's access token like this:

https://graph.facebook.com/oauth/access_token?client_id={App_ID}&client_secret={App_Secret}&grant_type=client_credentials

The URL above will return something like:

access_token={Your_App_Access_Token}

You can then include that access token in your graph API request like this: https://graph.facebook.com/{User_ID}?access_token={Your_App_Access_Token}

Including your app's access token will return additional information (e.g. email, if your app has permission).

Strangely, the graph API still doesn't send user picture information, so if it's the user's picture that changed, I need to use their OLD API like this:

https://api.facebook.com/method/users.getInfo?uids={User_ID}&fields=pic_square,pic_big&access_token={Your_App_Access_Token}&format=json

Note: I don't believe you actually need your app's access_token to fetch a user's pic_square and pic_big, but I'm sending it anyways.


For data that you have access to any time, you may wish to query for that data immediately so that requesting it does not slow down load times when the user returns to your application.

Dangit!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜