AnthonyLins / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

Facebook.init() and Facebook.login() problem #435

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Facebook app is loaded for the first time
2. First Facebook.init() is called and get response as null
3. Then Facebook.login() is called and again it returns null response since 
user is not allow the application permissions yet.

The problem arises at Facebook.handleAuthResponseChange() function.
In that function, we have this.
    if (_initCallback != null) {
        _initCallback(authResponse, null);
        _initCallback = null;
    }

    if (_loginCallback != null) {
        _loginCallback(authResponse, null);
        _loginCallback = null;
    }

However, this is kinda problematic since handleAuthResponseChange function is 
called again after the user allow the permissions. And it depends on the user 
action since the user may allow the permissions in any time as long as the 
facebook authentication window is open.

The correct beheviour should be like this:
    if (_initCallback != null) {
        _initCallback(authResponse, null);
        if(authResponse != null) _initCallback = null;
    }

    if (_loginCallback != null) {
        _loginCallback(authResponse, null);
        if(authResponse != null) _loginCallback = null;
    }

Original issue reported on code.google.com by m...@tolgaakyuz.org on 20 Aug 2012 at 12:59