Facebook 应用程序身份验证问题
我编写了以下代码来验证 Facebook 应用程序,但没有谷歌很多天它没有解决。 问题是,当首次访问应用程序时,系统会提示用户进入应用程序身份验证对话框。当用户允许应用程序时,它会不断闪烁网址。既不显示对话框也不显示应用程序。关闭浏览器后,是的,它运行正常。请问你能找出问题所在吗?我将非常感激。
代码:
$canvas_page = "---my canvas url----"; //i removed actual url here!
// Create our Application instance (replace this with your appId and secret).
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page) ."&scope=email,read_stream";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (!empty($data["user_id"])) {
echo 'Hello: '.$data["user_id"];
}else{
echo "What is the hell";
echo("<script> location.href='" . $auth_url . "'</script>");
}
I wrote the following code to authenticate a facebook application but instead of google many days it did not solve.
The problem is the when the application is first accessed user is prompt to application authentication dialog. when the user allows application it keeps blinking the url. neither shows dialog nor application. After closing the browser yes it runs fine. please can you find out what is the problem. I will be very thankful.
Code:
$canvas_page = "---my canvas url----"; //i removed actual url here!
// Create our Application instance (replace this with your appId and secret).
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page) ."&scope=email,read_stream";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (!empty($data["user_id"])) {
echo 'Hello: '.$data["user_id"];
}else{
echo "What is the hell";
echo("<script> location.href='" . $auth_url . "'</script>");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应该有效
It should work
使用:
与
top
一起使用!use:
With
top
!