James Portelli
James Portelli

Reputation: 43

Facebook JS SDK Log in to another account

I've been scratching my head for the past day trying to solve this one, and cant seem to find anything on the internet related to this relative common use case.

I have an app built using React(JavaScript) and I am making use of Facebook's JavaScript SDK to bring in Facebook authentication to one of my pages.

The issue I'm having is around this specific scenario whereby a person logs into Facebook, then logs into your app. Upon calling FB.login from my app it doesn't ask the user for any details and automatically logs him in, upon calling FB.logout from your app, the person is still logged into Facebook.

I want to be able to give the ability to my user to essentially switch to a different account from my app, so if the user is logged into his personal Facebook account upon calling FB.login from the app rather than it automatically taking his personal account the user will have the ability to enter in the details to another account, or at least when calling FB.logout rather than just invalidating the access token in the current app it will force logout the user from Facebook so that on FB.login this time he will be promoted for login details.

Any idea on how this can be accomplished with the Facebook SDK?

Thanks James

Upvotes: 2

Views: 1544

Answers (1)

kraila
kraila

Reputation: 31

You can remove permissions FB.api('/me/permissions', 'delete', function(response) {}); and if after that you will login again then you will have the posibility to switch the facebook account. enter image description here But you will loose the access token for current account.

Upvotes: 3

Related Questions