Facebook oauth对话框重定向在手机触摸网站登录问题后 [英] Facebook oauth dialog redirect after login problem on mobile touch site

查看:226
本文介绍了Facebook oauth对话框重定向在手机触摸网站登录问题后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将用户重定向到手机上的以下URL以进行应用授权:

We redirect users to below URL on mobile phones for application authorisation:

https://m.facebook。 com / dialog / oauth?client_id = XXXXXX& redirect_uri = http://www.server.com/callback.php& scope = offline_access,user_likes,publish_stream,publish_checkins,user_checkins& display = wap

如果用户在他/她的电话上登录到Facebook,没有问题,Facebook会自动重定向到oauth对话框页面。

If the user is logged in to Facebook on his/her phone, no problem, Facebook automatically redirects to oauth dialog page.

如果用户没有登录,Facebook请求他们先登录。

在wap站点(诺基亚手机)上,登录后重定向到oauth对话框,没有任何问题。
但是在触摸网站(iPhone)上,它将URL添加到URL,将用户重定向到他/她的Facebook主页。

If user is not logged in, Facebook asks them to login first.
On wap site(A Nokia phone), it redirects to oauth dialog without any problem after login. But on touch site(An iPhone), it add hastags to URL, redirects user to his/her Facebook homepage.

甚至在URL上显示= wap参数在这个问题上没有帮助。

Even display=wap parameter on URL doesn't help on this issue.

有关如何解决这个问题的任何想法?

Any ideas on how to solve this problem?

谢谢

推荐答案

其实这是一个更清洁的解决方案。 (我以前没有看到getLoginUrl的API。 http ://developers.facebook.com/docs/reference/php/facebook-getLoginUrl

Actually, here's a cleaner solution. (I hadn't seen the API for getLoginUrl at the time of my previous post. http://developers.facebook.com/docs/reference/php/facebook-getLoginUrl)

require_once("facebook.php");

$config = array(
    "appId" => APP_ID,
    "secret" => APP_SECRET
);

$facebook = new Facebook($config);

$params = array(
    "scope" => "offline_access,user_likes,publish_stream,publish_checkins,user_checkins",
    "redirect_uri" => "http://www.server.com/callback.php",
    "display" => "touch"
);

$url = $facebook->getLoginUrl($params);

header("Location: $url");

这篇关于Facebook oauth对话框重定向在手机触摸网站登录问题后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆