简体   繁体   中英

How to get the facebook user token with a facebook application

I have a facebook application with has to post updates on specific facebook page. The application has rights to post updates on the facebook wall of the page's admin. But how can i get the (admin's) users access token, which i need to get the access token of the page. Do i have to save the access tokenthe first time the user allows the app to post (offline access)?

Thanks for your reply!

I use the Facebook C# SDK as well. You'll need the following permissions:

manage_pages  
read_stream  
publish_stream

HTTP Get to "me/accounts" and get the .data object off of the returned value. This will be a list of the following:

  var list = ApiGet("me/accounts").data;
  foreach (dynamic acc in list)
  {              
    var name = (string)acc.name;
    var accessToken = (string)acc.access_token;
    var category = (string)acc.category;
    var pageId = (string)acc.id;
  }

As you can see, each one of the pages have their own unique access token.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM