生成“永不过期”访问Facebook页面的令牌
问题描述:
我设法通过API(C#)发布到Facebook页面,但是当页面的管理员注销时,出现以下错误:
I have managed to post to Facebook Page via API (C#), but when administrator of the page logs out, the following error occurs:
(OAuthException - #190)验证访问令牌时出错:会话无效,因为用户已注销。
"(OAuthException - #190) Error validating access token: The session is invalid because the user logged out."
如何生成从未过期的访问令牌?
How do I generate access token which is never expired?
我需要一个不打开Facebook登录对话框的解决方案。
I need a solution that doesn't open Facebook Login dialog.
答
- 为粉丝页面的管理员生成长命令令牌 http://appdevresources.blogspot.sg/2012/11/extend-facebook-access-token-make-it.html (图片不错的解释)
- 为粉丝页面本身生成长寿命令牌 http ://appdevresources.blogspot.sg/2012/11/retrieving-facebook-page-id-and.ht ml
- 使用令牌从2)发布在粉丝页面的墙上(不需要Facebook登录对话框)
- 结果令牌将永远不会过期(即使粉丝专页的管理员注销了)
- Generate long-lived token for admin of the fan page http://appdevresources.blogspot.sg/2012/11/extend-facebook-access-token-make-it.html (nice explanation with images)
- Generate long-lived token for fan page itself http://appdevresources.blogspot.sg/2012/11/retrieving-facebook-page-id-and.html
- Use token from 2) to post on the fan page's wall (no need for Facebook Login dialog)
- Resulted token will never expire (even if administrator of the fan page did log out)