Facebook Logout w/ Graph API

3,449 views
Skip to first unread message

Joe

unread,
Dec 8, 2011, 4:40:23 PM12/8/11
to phonegap
Hi there,

I'm using the ChildBrowser to login to FB and I was wondering if
anyone knew how to logout or expire a FB access token using the Graph
API? Seems pretty idiotic that you can login with it, but can't
logout, though from doing a bunch of FB integrations over the past
year, I'm surprised that Obama hasn't declared the cubicles where
their API teams sit a natural disaster area. If anyone's got a simple
method to just log a FB user out of an app can you please post it?

Many thanks!

Pete

unread,
Dec 8, 2011, 4:51:54 PM12/8/11
to phonegap
I am displaying a logout button:
define('LOGOUT',"http://m.facebook.com/logout.php?client_id=" .
APPID . "&redirect_uri="http://google.com "&client_secret=" . SECRET);

where APPID and SECRET are you facebook connect credentials

Joe

unread,
Dec 8, 2011, 8:38:33 PM12/8/11
to phonegap
Cool - quick and easy. I like that a lot. So, do I also need to supply
the user's access token, or does facebook already have that?

Joe

unread,
Dec 8, 2011, 8:56:02 PM12/8/11
to phonegap
Wait - is that from the Javascript API?

Pete

unread,
Dec 9, 2011, 3:04:30 AM12/9/11
to phonegap
since you mentioned ChildBrowser, I figured you are going to your own
web server where you have facebook connect implemented.
That's what I am doing. But now there is also a FB phonegag plugin, if
you are trying to use that, I don't know.

On my facebook connect page, I display a button with the LOGOUT link,
no javascript API

Joe

unread,
Dec 9, 2011, 9:21:41 AM12/9/11
to phonegap
Ah,

I use the Childbrowser, but I set my redirect uri to 'http://
www.facebook.com/connect/login_success.html', and if the return url
has the access_token in it, I grab it and close the Childbrowser - ala
the example that's in the Childbrowser plugin folder. I had taken the
proxy approach back in June with a project, but wanted to do it
without a proxy this time because I this customer just wants an app
and doesn't plan on having a web server running anywhere.

I tried just doing an ajax call to
http://m.facebook.com/logout.php?client_id=[MYAPPID]&redirect_uri=http://google.com&client_secret=[MYSECRETID]
but that doesn't seem to work and some digging on
facebook.stackoverflow.com makes it seem that this approach used to
work, but stopped working sometime @ May (without and head's up from
facebook of course).

So, I tried just pulling the url up on my phone and it just took me to
the facebook homepage without a logout which makes me think that maybe
the folks over there are right. I should probably be using the
Facebook plugin anyhow.

Between Facebook and Apple, I'm going go postal. The [nameless]
company that approves stuff for the App store rejected one of my apps
saying that the barcode scanner wasn't scanning QR codes and after
going back and forth with them for a few days, I took a video of my 3
year old scanning a QR code with the app and posted it to the
resolution center. That didn't go over to well and I got a response
saying that the [nameless company] at the res center scheduled a call
with Apple.


On Dec 9, 12:04 am, Pete <helpv...@gmail.com> wrote:
> since you mentioned ChildBrowser, I figured you are going to your own

> web server where you havefacebookconnect implemented.


> That's what I am doing. But now there is also a FB phonegag plugin, if
> you are trying to use that, I don't know.
>

> On myfacebookconnect page, I display a button with theLOGOUTlink,


> no javascript API
>
> On Dec 8, 5:56 pm, Joe <joehinde...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Wait - is that from the Javascript API?
>
> > On Dec 8, 5:38 pm, Joe <joehinde...@gmail.com> wrote:
>
> > > Cool - quick and easy. I like that a lot. So, do I also need to supply

> > > the user's access token, or doesfacebookalready have that?


>
> > > On Dec 8, 1:51 pm, Pete <helpv...@gmail.com> wrote:
>
> > > > I am displaying alogoutbutton:
> > > > define('LOGOUT',"http://m.facebook.com/logout.php?client_id=" .
> > > > APPID . "&redirect_uri="http://google.com"&client_secret=" . SECRET);
>

> > > > where APPID and SECRET are youfacebookconnect credentials


>
> > > > On Dec 8, 1:40 pm, Joe <joehinde...@gmail.com> wrote:
>
> > > > > Hi there,
>
> > > > > I'm using the ChildBrowser to login to FB and I was wondering if

> > > > > anyone knew how tologoutor expire a FB access token using the Graph

Joe

unread,
Dec 9, 2011, 11:27:51 AM12/9/11
to phonegap
Found 1/2 of my answer:

http://stackoverflow.com/questions/4895015/logout-from-facebook-using-childbrowser-adn-phonegap-in-iphone

Now just need to dig up a solution for android

On Dec 9, 6:21 am, Joe <joehinde...@gmail.com> wrote:
> Ah,
>

> I use the Childbrowser, but I set my redirect uri to 'http://www.facebook.com/connect/login_success.html', and if the return url


> has the access_token in it, I grab it and close the Childbrowser - ala
> the example that's in the Childbrowser plugin folder. I had taken the
> proxy approach back in June with a project, but wanted to do it
> without a proxy this time because I this customer just wants an app
> and doesn't plan on having a web server running anywhere.
>

> I tried just doing an ajax call tohttp://m.facebook.com/logout.php?client_id=[MYAPPID]&redirect_uri=http://google.com&client_secret=[MYSECRETID]
> but that doesn't seem to work and some digging onfacebook.stackoverflow.com makes it seem that this approach used to
> work, but stopped working sometime @ May (without and head's up fromfacebookof course).


>
> So, I tried just pulling the url up on my phone and it just took me to

> thefacebookhomepage without alogoutwhich makes me think that maybe


> the folks over there are right. I should probably be using theFacebookplugin anyhow.
>

> BetweenFacebookand Apple, I'm going go postal. The [nameless]

Reply all
Reply to author
Forward
0 new messages