[英]Facebook login with app not installed redirects to login page
On Android
I followed the Session
login sample to create the login flow for an app I am working on. 在
Android
我按照Session
登录示例创建了我正在处理的应用程序的登录流程。 The problem I'm having is on a few devices if the Facebook
app is not installed when the user logs in through Facebook
via the WebDialog
, then the page seems to redirect back to login page. 如果用户通过
WebDialog
通过Facebook
登录时未安装Facebook
应用程序,我遇到的问题是在一些设备Facebook
,然后该页面似乎重定向回登录页面。
I'm using Facebook
sdk 3.0.1, I've also upgraded to 3.5 to see if that would fix my issue, it did not. 我正在使用
Facebook
sdk 3.0.1,我也升级到3.5,看看是否能解决我的问题,但事实并非如此。 The sample provided in the 3.0.1 sdk doesn't even work and the sample included with the 3.5 sdk performs exactly like my app. 3.0.1 sdk中提供的示例甚至不起作用,3.5 sdk中包含的示例与我的应用程序完全相同。
I have tried this code below on other devices that do not have the Facebook
app installed and they work just fine. 我在其他没有安装
Facebook
应用程序的设备上尝试过以下代码,它们运行正常。 But when I try this on my Nexus 7 (4.3 installed) I run into the problem described above. 但是当我在我的Nexus 7(安装了4.3)上尝试这个时,我遇到了上述问题。
Any ideas? 有任何想法吗?
private Session.StatusCallback statusCallback = new SessionStatusCallback();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
Session session = Session.getActiveSession();
if (session == null) {
if (savedInstanceState != null) {
session = Session.restoreSession(this, null, statusCallback, savedInstanceState);
}
if (session == null) {
session = new Session(this);
}
Session.setActiveSession(session);
if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) {
session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));
}
}
}
@Override
public void onStart() {
super.onStart();
Session.getActiveSession().addCallback(statusCallback);
}
@Override
public void onStop() {
super.onStop();
Session.getActiveSession().removeCallback(statusCallback);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Session session = Session.getActiveSession();
Session.saveSession(session, outState);
}
private void Login() {
Session session = Session.getActiveSession();
if (!session.isOpened() && !session.isClosed()) {
session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));
} else {
Session.openActiveSession(this, true, statusCallback);
}
}
private void Logout() {
Session session = Session.getActiveSession();
if (!session.isClosed()) {
session.closeAndClearTokenInformation();
}
}
private class SessionStatusCallback implements Session.StatusCallback {
@Override
public void call(Session session, SessionState state, Exception exception) {
//check session and see if we are logged in.
}
}
Edit: An update to this. 编辑:对此的更新。 I've tried this same example/app on a Samsung Galaxy S4 (Running 4.2.2) Model number SGH-I337, and it is not working on this device either.
我在三星Galaxy S4(运行4.2.2)型号SGH-I337上尝试过相同的示例/应用程序,但它也无法在此设备上运行。 It does something a little different in that it will let you hit ok if you have approved the app on
Facebook
or it will let you go through the motions to allow the app through Facebook
, but then it will display a page saying "Error Not Logged In: You are not logged in. Please login and try again." 它做了一些不同的事情,如果你已经批准
Facebook
的应用程序它会让你点击确定它会让你通过动作通过Facebook
允许应用程序,但它会显示一个页面说“错误未记录在:您尚未登录。请登录并重试。“
Edit 2:In an attempt to verify this is not exclusive to our app, we installed Candy Crush and got the same error. 编辑2:为了验证这不是我们的应用程序独有的,我们安装了Candy Crush并得到了同样的错误。
Its probably just an error with Facebook, send a bug report to them and specify the devices and apps you tested and their respective results. 它可能只是Facebook的一个错误,向他们发送错误报告,并指定您测试的设备和应用程序及其各自的结果。 Here is the exact same bug reported on the Facebook website: https://developers.facebook.com/bugs/160597354148944
以下是Facebook网站上报告的完全相同的错误: https : //developers.facebook.com/bugs/160597354148944
Facebook replied to this by saying 'not enough evidence, we are closing this' but maybe if you post some more evidence then they might re-open and fix this. Facebook回答说“没有足够的证据,我们正在关闭这个”,但也许如果你发布更多的证据,那么他们可能会重新打开并解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.