[英]Facebook fails to redirect to application URL after login
I am creating facebook application. 我正在创建Facebook应用程序。 If user is not logged on facebook I redirect them to FaceBook login that redirects to my application URL after they logged to facebook. 如果用户未登录Facebook,我会将其重定向至FaceBook登录名,该用户登录至Facebook后将重定向至我的应用程序URL。 Problem is that user is redirected to facebook.com insted of facebook application URL 问题是用户被重定向到由Facebook应用程序URL插入的facebook.com
Here is code that I am using to check if user logged to FaceBook 这是我用来检查用户是否登录到FaceBook的代码
function statusChangeCallback(response) {
if (response.status === 'connected') {
// Logged into your app and Facebook.
FillInfo();
} else if (response.status === 'not_authorized') {
window.top.location("https://apps.facebook.com/memorygameonfb/?fb_source=bookmark&ref=bookmarks&count=0&fb_bmpos=3_0")
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
window.top.location = "https://www.facebook.com/login.php?api_key=id&skip_api_login=1&display=page&redirect_uri=https://apps.facebook.com/memorygameonfb/?fb_source=bookmark&ref=bookmarks&count=0&fb_bmpos=3_0"; }
}
The reason they are being redircted to facebook.com is becasue that is where you are sending them 将它们重定向到facebook.com的原因是,因为这是您将其发送到的位置
You need to create $params
so when your user logs in you can redirect them to your app. 您需要创建$params
以便在用户登录时将其重定向到您的应用程序。
You can find the dox on this Here 您可以在此处找到dox
$params = array(
'scope' => 'read_stream, friends_likes',
'redirect_uri' => 'https://www.myapp.com/post_login_page' //This redirects to ur APP!
);
$loginUrl = $facebook->getLoginUrl($params);
I personally am not great with JS
I use php for facebook api
I think it is easier to manage then the JS API
我个人对JS
不太满意,我将php用于facebook api
我认为比JS API
更容易管理
If you would like to download a basic app allowing you to login with php
如果您想下载一个基本的应用程序,允许您使用php
登录
Click Here and follow the readme file
for instructions. 单击此处,然后按照readme file
中的说明进行操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.