10

I am using Facebooker with Rails to connect my application to Facebook. I can direct the user through the authorization process and through the process of granting offline access to my application.

How do I actually go about accessing the information offline? Is there a way to request a session_key that does not expire that I can use at a later point, so long as the user has not revoked the permissions for my application on Facebook?

Any help greatly appreciated. Advice need not be rails specific.

4

4 回答 4

2

一旦您请求并获得授权,您在 Facebook 的 HTTP POST 参数中获得的会话密钥 (fb_sig_session_key) 将不会过期。

您可以通过检查 fb_sig_expires 参数来检查您是否有这样的密钥,如果这是“0”,则会话密钥没有到期。

如果您有 auth_token,那么您可以调用 getSession 来获取会话密钥并检查 expires 字段:

var auth = _auth.getSession(AuthToken);
string sessionKey = auth.session_key;
long uid = auth.uid;
bool expires = auth.expires > 0;
于 2009-03-11T13:47:17.337 回答
1

我刚刚在我的博客上做了一个教程,一步一步地解释了如何访问离线用户的数据。它假定您正在使用 RoR 和 Facebooker 插件。

于 2009-09-10T12:11:18.197 回答
0

编辑:显然,授予“offline_access”仍然给你(并将继续这样做)一个无限的会话密钥。只需保存此特殊键并在调用 Status.get 等时使用它。请参阅此处以获取(PHP)代码示例。

http://wiki.developers.facebook.com/index.php/New_Design_User_Login

许多 API 调用不再需要会话密钥

因此,如果您的应用程序被授予离线访问权限,您可以使用此处列出的 API 调用而无需 session_key。

我们正在更改更多方法,因此当用户离线时您不需要会话密钥来执行某些操作,例如发送通知。

于 2009-03-06T03:27:43.920 回答
0

一旦您从用户那里获得离线访问权限,诀窍就是使用filter_key“网络”参数进行调用。

在 PHP 中,它是:

$feed = $facebook->api_client->stream_get($uid, '', '', '', 20, 'network', '');

试试吧,它的工作原理......

于 2009-09-05T19:20:51.987 回答