Samssonart
Samssonart

Reputation: 3593

Why can't I log a user out of facebook in an AIR desktop application?

I'm building an AIR desktop app with facebook support using Adobe Flash builder. So far it's working alright, except for one detail, once a user logs in, that session stays open, even if the logout button is pressed. My logout code look like so:

                protected function logout():void {
                   FacebookDesktop.logout(handleLogout, APP_ORIGIN);
                }

I set APP_ORIGIN to "http://www.facebook.com". I checked Adobe's documentation and they say: appOrigin:String (default = null) — (Optional) The site url specified for your app. Required for clearing html window cookie. But I don't know what that means, what is the 'site url specified by my app'? Where do I get it? Sorry if this is a noob question.

Upvotes: 0

Views: 1040

Answers (3)

StephenNYC
StephenNYC

Reputation: 1264

This is what worked for me

    public function facebookLogout():void {
        if (FacebookDesktop.getSession() != null) {
            var uri:String = "http://www.facebook.com/";
            var params:URLVariables = new URLVariables();
            params.next = uri;
            params.access_token = FacebookDesktop.getSession().accessToken;
            var req:URLRequest = new URLRequest("https://www.facebook.com/logout.php");
            req.method = URLRequestMethod.GET;
            req.data = params;
            var netLoader:URLLoader = new URLLoader();
            netLoader.load(req);
            FacebookDesktop.logout(handleLogout, uri);      
        }
    }

Upvotes: 1

Peter
Peter

Reputation: 31

After trying 20 different workarounds, the only solution that worked for me is: http://nekyouto-tech.blogspot.de/2012/09/fb-adobe-air-logout-bug.html

var uri:String = APP_ORIGIN;
var params:URLVariables = new URLVariables();
params.next = uri;
params.access_token = FacebookDesktop.getSession().accessToken;
var req:URLRequest = new URLRequest("https://www.facebook.com/logout.php");
req.method = URLRequestMethod.GET;
req.data = params;
var netLoader:URLLoader = new URLLoader();
netLoader.load(req);
FacebookDesktop.logout(handleLogout, APP_ORIGIN);

Upvotes: 3

Samssonart
Samssonart

Reputation: 3593

Nevermind, I figured it out, what I did was define my app origin as localhost and now it works.

Upvotes: 0

Related Questions