set user (access token) within FB.init

筅森魡賤 提交于 2019-12-05 07:51:32

Try passing the access token you want to use as part of the params object you give to FB.api – it should work the same way as it does when accessing the API server-side.

FB.api(
  '/me/feed',
  'post',
  {
    access_token : 'access_token_for_some_user_fetched_from_your_database',
    additional_parameter_foo : 'bar'
  }
);

I have more knowledge reagrding the PHP SDK, but in PHP you could just replace the "me" with the user id and I suppose it will work for you as well:

FB.api('/'+fbuserid+'/...');

But you should be aware that the access token of the users change, after changing passwords and logging in and out from Facebook.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!