开发者

Android Facebook SDK - How to log in as another user?

I am using the official Facebook SDK for Android in my app.

I have managed to log in successfully,

but the problem arises when I try to log in as another user:

I click on the link that says Logged in as [name]... Not you?

but my application proceeds anyway and posts to my wall...

(as if I have clicked "Allow")

I discovered that clicking on that link throws a facebook exception and retries the request,

so I tried putting a call to logout() in the catch clause.

That made it possible to log in as a new user,

but the next time I run the app,

again, the old user is logged-in...

(Logged in as [old_user]. Not you?)

 

My question is:

Why does the first use开发者_运维百科r's login persist forever

and how to properly handle a click on "Not You" link?

 

My current solution is to always call logout() before authorize() method

but this forces the user to always have to enter his/her email/password

which is not acceptable either.


The facebook access token is saved by SessionStore. When loggin into Facebook, it will try to restore the access token from SessionStore. So, I think you can explicitly call facebook.logout and SessionStore.clear() when user exit your application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜