Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9878] TiAPI: Facebook authorization has changed and login does not work anymore

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-08-09T02:54:40.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sSprint 2012-14 Core, Sprint 2012-14 MW, Sprint 2012-16 API, Release 3.0.0, Release 2.0.3
ComponentsTiAPI
Labelsapi, module_api, parity, qe-testadded, regression
ReporterDavide Cassenti
AssigneeBlain Hamon
Created2012-07-05T04:08:35.000+0000
Updated2012-08-10T11:27:50.000+0000

Description

Problem description

When using Ti.Facebook to login, once the user has entered their credentials and clicks login, the screen shows a 'Page not found' error and the login fails. However, trying to login again the second time, works. It also works if the app on Facebook is set as Native/Desktop and not Web.

Steps to reproduce

1. Create a Facebook app (be sure it is set to Web, as it is by default) 2. Create an app with the code below (set the app id accordingly to the Facebook app) 3. Click the 'Login with Facebook' button 4. Enter a valid Facbeook account credentials and click Login
Ti.Facebook.appid = '[APP ID]';
Ti.Facebook.permissions = ['publish_stream'];
Ti.Facebook.addEventListener('login', function(e) {
    if (e.success) {
        alert('Logged in');
    }
});
Ti.Facebook.addEventListener('logout', function(e) {
    alert('Logged out');
});

var win2 = Ti.UI.createWindow();

// Add the button.  Note that it doesn't need a click event listener.
win2.add(Ti.Facebook.createLoginButton({
    top : 50,
    style : Ti.Facebook.BUTTON_STYLE_WIDE
}));

win2.open();

Expected result

Facebook authentication happens and we are able to log into Facebook.

Current result

A 'Page not found' screen is shown as soon as the login is performed.

Related links

Looks like the problem is also present on native apps, and it does not occour if the app is set as Native/Desktop. See this topic for some details: http://developers.facebook.com/blog/post/2012/03/02/enhanced-auth-dialog-and-updates-to-permissions/

Attachments

FileDateSize
log.txt2012-08-07T05:07:44.000+00009309
Screenshot 2012.07.16 15.56.59.png2012-07-16T15:57:54.000+000052567

Comments

  1. Bryan Hughes 2012-07-05

    A quick test in Mobile Web shows that it's having some issues too, although not as severe. Everything logs in OK, but the log in window doesn't disappear and we don't get the callback saying we are logged in. The user is logged in though, and if the page is reloaded, then everything works just fine. I'm not sure if it's caused by the same underlying issue causing problems on iOS and Android, but the timing is suspicious.
  2. Shak Hossain 2012-07-06

    This issue came from community (titans) and forwarded to us by Jeff H. Can platform look into this ASAP?
  3. Shannon Hicks 2012-07-12

    What was the resolution here? My assumption was that this was a FB error, since others (not Titanium people) were having problems with both the API and web versions? Just curious.
  4. Rima Umbrasas 2012-07-16

    Reopening issue. After pressing "Login with Facebook" button, an error message "An error occurred. Please try again later" appears. After clicking "OK" button and putting the credentials it will be possible to login to the Facebook. Tested with: Titanium Studio, build: 2.1.1.201207121732 Titanium SDK: 2.1.1.v20120712160111 Devices: iPhone Simulator 5.1; iPad 2 (5.1.1); iPod 5.1
  5. Tamila Smolich 2012-07-16

    Closing as fixed. Tested with: Titanium Studio, build: 2.1.1.201207161421 Titanium SDK: 2.1.1.v20120712160111 Device: iPad 3rd gen (5.1.1)
  6. Tamila Smolich 2012-07-16

    For QE - use this code with specified app. ID:
       Ti.Facebook.appid = '134793934930';
       Ti.Facebook.permissions = ['publish_stream'];
       Ti.Facebook.addEventListener('login', function(e) {
           if (e.success) {
               alert('Logged in');
           }
       });
       Ti.Facebook.addEventListener('logout', function(e) {
           alert('Logged out');
       });
        
       var win2 = Ti.UI.createWindow();
        
       // Add the button.  Note that it doesn't need a click event listener.
       win2.add(Ti.Facebook.createLoginButton({
           top : 50,
           style : Ti.Facebook.BUTTON_STYLE_WIDE
       }));
        
       win2.open();
       
  7. Bryan Hughes 2012-07-16

    For Mobile Web: you will need to use a different App ID than the one mentioned by @Tamila that is custom tailored to your testing environment. See http://docs.appcelerator.com/titanium/2.1/index.html#!/guide/Mobile_Web_Debugging_and_Testing_Tools-section-31525350_MobileWebDebuggingandTestingTools-Facebook for more information about using Facebook on MW.
  8. Vishal Duggal 2012-08-06

    Reopening to edit labels
  9. Neha Chhabra 2012-08-07

    For SDK 2.0.3,Application (for the code posted by Tamila in the comments) crashes on Android but not on iOS.Please find the errorlogs attached in the bug. Tested with Titanium SDK: 2.0.3.v20120806151610 Tested with Titanium Studio: 2.1.1.201207271312 Platform & version: iOS (5.1) Device Details: iPhone 4S, Android Emulator (2.2), Android Galaxy Note (2.3.6) Host Operating System: OSX 10.8
  10. Ping Wang 2012-08-07

    The NPE error reported in the last comment is because there is no constant "Ti.Facebook.BUTTON_STYLE_WIDE" in Android in 2_0_X branch. Those constants were added in 2_1_X (TIMOB-6234) and will not be back ported to 2_0_X. Therefore, for the test in 2_0_X branch we should use the test case below:
        Ti.Facebook.appid = '495338853813822';
        Ti.Facebook.permissions = ['publish_stream'];
        Ti.Facebook.addEventListener('login', function(e) {
            if (e.success) {
                alert('Logged in');
            }
        });
        Ti.Facebook.addEventListener('logout', function(e) {
            alert('Logged out');
        });
         
        var win2 = Ti.UI.createWindow();
         
        // Add the button.  Note that it doesn't need a click event listener.
        if (Titanium.Platform.name == 'android') {	
        	win2.add(Ti.Facebook.createLoginButton({
        		top : 50,
        		style : 'wide'
        	})); 
        } else {	
        	win2.add(Ti.Facebook.createLoginButton({
        		top : 50,
        		style : Ti.Facebook.BUTTON_STYLE_WIDE
        	})); 
        }
         
        win2.open();
        
  11. Neha Chhabra 2012-08-07

    closing and verified( as per the code posted by Ping Wang in the comment) Tested with Titanium SDK: 2.0.3.v20120806151610 Tested with Titanium Studio: 2.1.1.201207271312 Platform & version: iOS (5.1) Device Details: iPhone 4S, Android Emulator (2.2), Android Google Nexus (4.0.2), Android Galaxy Note (2.3.6) Host Operating System: OSX 10.8
  12. Neeraj Gupta 2012-08-08

    Note that the property BUTTON_STYLE_WIDE was defined on Android in 2.1.0 (TIMOB-6234). Earlier, it existed only on iOS. This is outside the scope of the Facebook SDK update. So any applications that upgrade from 2.0.X to 2.0.3 will work fine without any changes. The test case in the bug was written with the 2.1.0 SDK in mind so it does not work for 2.0.X. As far as the end developers are concerned this is a non issue.
  13. Neha Chhabra 2012-08-09

    Reopening to update labels.

JSON Source