FaceBook Setup Issue

First use this url to ask user to add your facebook app(if user not login, facebook will redirect to login page and then go to this url)
https://graph.facebook.com/oauth/authorize?redirect_uri=< http://YOUR_FaceBookCallback_SERVLET>&client_id=<YOUR_app_key>

Then you can use this url to ask user grant the extend permission(allow offline access)
http://www.facebook.com/authorize.php?api_key=<YOUR_app_key>&v=1.0&ext_perm=offline_access&next=< http://YOUR_FaceBookCallback_SERVLET>=true&return_session=true

Then you will have an auth_token in the url, use Get to take it out and use it to generate the infinite session key. For php version, it looks like this:
1. $auth_token=$_GET['auth_token'];
2. $infinite_key_array = $facebook->api_client->auth_getSession($auth_token);
3. print_r($infinite_key_array); if the key is infinite, the expire will be 0

The result will be: Array ( [session_key] => c03eed6d6f07f335d4a36cd2-598500288 [uid] => 598500288 [expires] => 0 )
c03eed6d6f07f335d4a36cd2 is the key , while 598500288 is the user id

Thus you can store the infinite key for future use

Optional reading:

1.This mention Facebook is going to stop granting infinite sessions to Web-based applications automatically,
Desktop applications will continue to be granted a 24 hour session key, and mobile clients will continue to receive infinite sessions :
http://wiki.developers.facebook.com/index.php/New_Design_Platform_Changes#Changes_to_Session_Keys
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值