Do I need “offline_access” permission if I request publish_stream?

人盡茶涼 提交于 2019-12-08 01:16:13

问题


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

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