GRiMe2D / facebook-actionscript-api

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

facebook language settings remain after logging out #362

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am building an Adobe air application for a public space where users with 
different nationalities log in to Facebook, post an image and log out. Logging 
out is handled automatically when upload was completed.

The problem is that when someone logs in, although the login and password 
fields are empty, the login window shows up with the facebook language settings 
of the previous user. It appears that Facebook still keeps those settings 
somewhere, even after a "successful" logout.

I would expect the window to show up in a default language. Instead the login 
window will show up in the language of the last user.

Question 1: Is there any way to remove the user's language settings when or 
after logging out?

Question 2: Is there a way to make sure the login window will always display in 
a preferred language?

I changed the "params.next" line in the logout function in FacebookDesktop.as 
which effectively removes the username and password from the new login window 
(so it looks like logging out was successful). I used the "en-gb" version 
hoping it would have some effect but that was wishful thinking.

Here is my logout function:

protected function logout(callback:Function=null, appOrigin:String=null):void 
{
        logoutCallback = callback;

        //clears cookie
        var params:Object = {};
        if (session != null) {
            params.access_token = session.accessToken;
        }
        params.method = "auth.logout";
        //params.next = "http://static.ak.fbcdn.net/connect/xd_proxy.php#origin="+(appOrigin?appOrigin:"");
        params.next = "http://en-gb.facebook.com/"

        var req:FacebookRequest = new FacebookRequest();
        openRequests[req] = handleLogout;
        req.call("https://www.facebook.com/logout.php", 'GET', handleRequestLoad, params);

        var so:SharedObject = SharedObject.getLocal(SO_NAME);

        so.clear();
        so.flush();

        session = null;
}

I tried manually removing the Facebook cookie that was stored on the hard drive 
(C:\Users\Username\AppData\Roaming\Microsoft\Windows\Cookies) but that did not 
help.

I have also tried setting the locale default on english like this (also in 
FacebookDesktop.as):

public static function set locale(value:String):void {
        getInstance().locale =  "en_GB"//hack value;
}

None of this made a difference...

I use the graph api desktop v 1.7 on Windows 7

Original issue reported on code.google.com by da...@louter.info on 29 Sep 2011 at 11:10

GoogleCodeExporter commented 9 years ago
If you look into the facebook url that is used to login: 
https://login.facebook.com/login.php

You'll notice there is a javascript function that is called to change the 
language: 
intl_set_cookie_locale()
which of course sets the locale from where you want. I tried to use 
'ExternalInterface' to invoke javascript on the page which is supposed to be 
supported under adobe air but am getting an exception saying that it only 
supports certain browsers. My method is a bit of a hack, but the only way I've 
found to get around it.

Let me know if you've found a solution.

Original comment by justinma...@gmail.com on 13 Oct 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Just as an fyi, this is not a fix just a method of a potential solution.

Original comment by justinma...@gmail.com on 13 Oct 2011 at 3:56

GoogleCodeExporter commented 9 years ago
This is a possible workaround, the desktop api hits this url to login:
https://graph.facebook.com/oauth/authorize?client_id=YOUR_APP_ID&redirect_uri=ht
tp://www.facebook.com/connect/login_success.html&display=popup
You'll notice that if you remove the display=popup query param, the Facebook 
login page will show a larger page with language options near the bottom. In 
LoginWindow.as, formatData() method, remove the line of code 
vars.display='popup'. In the same class, be sure to specify a larger 
WINDOW_WIDTH/HEIGHT value to accommodate the larger login screen. This screen 
does not seem to scale to fit the browser window.

Original comment by edwar...@gmail.com on 19 Oct 2011 at 9:07