-1

I created web application using Facebook C# SDK 5.3.2. I can post messages to my wall. But I want to collect access tokens for my friends' Facebook accounts and store them to use later to post messages to their wall.

Is it possible to get their access token with their Facebook account info. I can get access token for myself with "App ID" and "App Secret. Do I need also add application for my friends' Facebook to get this credentials.

halfer
  • 19,824
  • 17
  • 99
  • 186
Alaattin Bedir
  • 193
  • 2
  • 3
  • 10

2 Answers2

1

You don't need to store access_token for any user, since it's something time based. Instead ask for publish_stream permission and post messages to their wall using application access_token

From Facebook documentation on publish_stream permission:

Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends. With this permission, you can publish content to a user's feed at any time, without requiring offline_access. However, please note that Facebook recommends a user-initiated sharing model.

Juicy Scripter
  • 25,778
  • 6
  • 72
  • 93
0

the only way to get it done, is that your friends login into your application with their accounts and grant you the publish permission (if you want to publish when they are online) and the offline_access permission, to publish in any moment.

You have to think in the big security issue that this situation potentially represents. Good luck.

maxijb
  • 541
  • 4
  • 13
  • This isn't true, you don't need `offline_access` permissions to publish content once `publish_stream` permission granted. See documentation for `publish_stream` permission https://developers.facebook.com/docs/reference/api/permissions/ – Juicy Scripter Dec 19 '11 at 22:55
  • You do need offline_access to post to their walls "later". Otherwise the token given for plain publish_stream access may expire. – Brent Baisley Dec 20 '11 at 00:09
  • @BrentBaisley, this is wrong! You can use application `access_token` to post to user feed even if user isn't interacting with your application and you have no access_token of user, read Facebook documentation about `publish_stream` permission (i've provided link above)! – Juicy Scripter Dec 21 '11 at 08:51
  • @JuicyScripter, have you tried posting to a users wall with an app login token instead of a user token? You have to have a token, the app login token states it is valid for administrative tasks, not wall post. But user tokens expire, unless you ask for offline access. I wonder if the documentation is flawed. – Brent Baisley Dec 21 '11 at 18:39
  • @BrentBaisley, Sure i did. A couple of applications I'm working on do this on daily basis using application access_token. – Juicy Scripter Dec 21 '11 at 18:50