Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2273] Facebook Module: Can't login another FB account once logged in first.

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionNot Our Bug
Resolution Date2016-07-18T10:37:30.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsFacebook
Labelsdifferent_account, facebook, login
ReporterShuo Liang
AssigneeHans Knöchel
Created2016-07-14T10:44:55.000+0000
Updated2016-07-18T10:37:30.000+0000

Description

Reproduce Step.

1. Copy the following code to app.js file.
var fb = require('facebook');

var win = Ti.UI.createWindow({
	title : 'Login/Logout',
	backgroundColor: "white"
});

//fb module listener
fb.addEventListener('login', function(e) {
	if (e.success) {
		alert('login from uid: ' + e.uid + ', name: ' + JSON.parse(e.data).name);
	} else if (e.cancelled) {
		// user cancelled
		alert('cancelled');
	} else {
		alert(e.error);
	}
});

fb.addEventListener('logout', function(e) {
	alert('logged out');
});

var loginButton = fb.createLoginButton({
	readPermissions : ['read_stream', 'email'],
	height: 100,
	width: 100,
	top : 260
});
win.add(loginButton);

var CurrentStatus = Ti.UI.createButton({
	title : 'Current Status',
	top : 50,
	width : 160,
	height : 40
});
win.add(CurrentStatus);

CurrentStatus.addEventListener('click', function() {
	if (fb.getLoggedIn()) {
		alert("Current UID: " + fb.getUid());
	} else {
		alert('Not logged in.');
	}
});

win.open();
2. Setting all the necessary key pair for facebook (ref: our doc) 3. Run the app.

Problem.

1. If you run it first time, it will be fine. Then if you click the same button to logout. Then click login again. You will not able to login another account. Always the same one. 2. Even you set the facebook account in device -> setting, it will not impact the result. Change the account in setting, does not help too.

Note.

Sometimes, clean the browser will help. But not all the time, not sure why. Help advise.

Comments

  1. Ingo Muschenetz 2016-07-14

    [~sliang] please change the title to better indicate the problem
  2. Hans Knöchel 2016-07-15

    [~sliang] As discussed on Flowdock, I am 90 % sure that this is the native behavior of the Facebook SDK. As [~jvennemann] noted, the logout method is not used to logout the user from Facebook, but only from the current app that used the Facebook SDK. In detail that means that - as long as the user a) has the Facebook app installed or b) is logged into Facebook in Safari / native browser, the "xxxx already authorized " will appear. If really necessary, I would create a native Xcode-project to demonstrate the behavior, but that be obsolete. Please let me know what they need here.

JSON Source