I'm learning to integrate facebook login in WP8.1. My problem is that I need facebook to ask me for my credentials every time I press the connect button but it does not do that, it remembers the last log in and prompts "You have already authorized my_app_name". How do I go around this? Is there anyway I can prevent facebook to remember the last login? I've followed THIS tutorial, just fyi
Any help would be really appreciated. Thanks.
The web authentication broker must have enabled
single-sign-on
that prevents asking credentials the next time it is invoked. This behavior is obtained when a callback URI is not specified in the authentication method ofWebAuthenticationBroker
.WebAuthenticationBroker.AuthenticateAsync
has 2 overloads - one accepting callback URI and the other not. You can use the one with callback URI and provide the default redirect URL of Facebook (https://www.facebook.com/connect/login_success.html)Refer this link for details.
Also as Abdulwahab Suleiman - MSFT mentioned in the comment, once Facebook has authorized your app - you have to get it unauthorized for the permissions prompt to be seen again. After authorization you can see your app listed in Facebook (Settings -> apps). You can either remove it from there or revoke the Facebook permission through code.
I figured out the solution to this. When the user taps on the connect to facebook button, I silently call the logout uri using
WebAuthenticationBroker.AuthenticateSilentlyAsync
. This does not open the UI thread and logs out the previously logged in user before opening the facebook connect dialog.So essentially every time a user tries to connect my application to facebook, it logs out the previous logged in user before presenting the connect dialog.