本文介绍了让offline_access与Facebook合作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有Rails的Facebooker将我的应用程序连接到Facebook。我可以指导用户通过授权过程,并通过授予离线访问我的应用程序的过程。



我如何真正去离线访问信息?有没有办法请求一个不会过期的session_key,我可以在稍后点使用,只要用户没有撤​​消我在Facebook上的应用程序的权限?



解决方案

一旦你要求并被授予,离线访问你在来自Facebook的HTTP POST参数(fb_sig_session_key)将无法到期。



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



如果你有一个auth_token,那么你可以调用getSession获取会话密钥并检查过期字段:

  var auth = _auth.getSession(AuthToken); 
string sessionKey = auth.session_key;
long uid = auth.uid;
bool expires = auth.expires> 0;


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.

解决方案

Once you ask for, and are granted, offline access the session key you get in the HTTP POST parameters from Facebook (fb_sig_session_key) will have no expiry.

You can check you have such a key by checking the fb_sig_expires parameter, if this is "0" then the session key has no expiry.

If you have an auth_token then you can call getSession to get the session key and check the expires field:

var auth = _auth.getSession(AuthToken);
string sessionKey = auth.session_key;
long uid = auth.uid;
bool expires = auth.expires > 0;

这篇关于让offline_access与Facebook合作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 20:59