问题
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?
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/7328342/do-i-need-offline-access-permission-if-i-request-publish-stream