2

For Facebook, I requested email and publish_stream.

I got their access_token. yay!

Now....when I try to send a POST to their wall (/feed), I get this message:

{"error":{"type":"OAuthException","message":"Error validating access token: Session has expired at unix time 1315342800. The current unix time is 1315363038."}}

Why? Do I need offline_access?

user847495
  • 9,831
  • 17
  • 45
  • 48

2 Answers2

3

No. From Facebook's documentation:

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.

To publish to the users feed after their short lived token expires, send over an access token in this format:

appid|appsecret

This token format is taken from the PHP SDK source code. In this case you won't be able to use /me/feed so you would need to POST to /userid/feed

bkaid
  • 51,465
  • 22
  • 112
  • 128
  • The definition for the application access token is as follows: "The application access token, useful for gathering public information about users and applications." It does not say that you can publish to stream. – Zorayr Dec 05 '11 at 05:22
  • Are you using OAuth 2.0 and Facebook PHP SDK's latest version? Thanks a lot by the way -appreciate it. – Zorayr Dec 07 '11 at 06:04
1

Unless you request offline_access you get a token that expires after a set amount of time.

So yes, if you're not making the API request (POST) within a short amount of time of requesting the token, you need that.

Brian Roach
  • 76,169
  • 12
  • 136
  • 161