从CodeIgniter发布到Facebook上的用户墙

问题描述:

这个问题已经被问到了,但是接受的答案是没有帮助的,因为海报似乎已经弄清楚了自己,并忽略了他们如何获得访问令牌。

This question was asked already, but the accepted answer is not helpful as the poster seems to have figured it out themself and left out how they got the access token.

从Codeigniter应用程序发布在Facebook墙上

无论如何,似乎我可以重定向到登录网址并登录,但没有找到auth令牌。抛出此错误:

Anyhow, it seems that I can redirect to the login url and log in , but its not finding the auth token. Throwing this error:


致命错误:未捕获OAuthException:活动访问令牌必须是
用于查询有关当前用户的信息。抛出
/home/howekevin/biologicalfinder.com/dev/application/libraries/base_facebook.php
在第1040行

Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /home/howekevin/biologicalfinder.com/dev/application/libraries/base_facebook.php on line 1040

另外,如果您使用SDK和 var_dump $ user 中的示例,我将获得 int 0 即使我登录后,我注意到它使用了很多 $ GET 数组的东西,而CodeIgniter不会这样。有没有人解决了这个问题?

Also, if you use the example on the SDK and var_dump $user, I'm getting int 0 even after I'm logged in. I notice it's using a lot of $GET array stuff, and CodeIgniter doesn't jive with that. Has anyone solved this issue?

啊,所以你发现了Elliot的破解代码。给我的oauth库旋转:

Ahh, so you found Elliot's broken code. Give my oauth library a spin:

http://getsparks.org/packages/codeigniter-oauth/versions/HEAD/show

或Phil Sturgeon's:

Or Phil Sturgeon's:

http://getsparks.org/packages/oauth2 / versions / HEAD / show

我们的代码实际上可以工作; )

Our code should actually work ; )

请注意,我的和Phil的图书馆只处理auth,但似乎这是你目前遇到的麻烦(这是最难的部分)。查看Facebook开发者文档的其余部分(如果您可以发送POST请求,您可以这样做)。

Mind you mine and Phil's libraries only handle auth, but seems that's what you're having trouble with at the moment (and it's the hardest part). Check out the Facebook developer docs for the rest (if you can make a POST request, you can do this).