facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 910 forks source link

FBSDK does not allow me to sign in different account after logout #712

Open danish519 opened 4 years ago

danish519 commented 4 years ago

when i login to fbsdk it's work fine then i want to logOut which i used to LoginManager.logOut() that's what they mentioned to remove user cache . when i click facebook button again i'ts picks my previous account of facebook weather i login in web or app "and say continue with Danish Hussain". it should not ask me to login with another account.

BanidAzin commented 4 years ago

I'm also having the same issue. Anyone found any solution for this ?

SMKH-PRO commented 4 years ago

same issue

ratnani1996 commented 4 years ago

Same issue @danish519 have you found any solution to it?

jayawasthi commented 4 years ago

same here

crzycoder commented 4 years ago

@ratnani1996 use this use access_token which you get AccessToken.getCurrentAccessToken() from here logOut = (access_token) => { let logOut = new GraphRequest( "me/permissions/", { accessToken: access_token, httpMethod: 'DELETE' }, (error, result) => { console.log('LogOut Result---->>>', result); if (error) { console.log('Error fetching data: ' + error.toString()); } else { LoginManager.logOut(); } }); new GraphRequestManager().addRequest(logOut).start(); };

kishansbs commented 4 years ago

@crzycoder also using this not able to change account.

crzycoder commented 4 years ago

@kishansbs changing account is not possible in latest react-native-fbsdk . the method I mentioned is for select account again from facebook. it's select account only which you are sign in in facebook app which is currently login. If you change account on facebook app the sdk shows that account. The method which i mentioned is only used for clear FBSDK cache forcefully.

ratnani1996 commented 4 years ago

@crzycoder thanks for the response, but it didn't work for me. I am unable to change my facebook account.

robyweb commented 4 years ago

Has anyone found a solution for this? We can't get our Facebook login approved because the Facebook testers keep trying to sign in with an account from a previous session.

mununki commented 4 years ago

Does anybody have a solution? I can't remember the moment exactly, but I could switch the account after I changed the account in the safari in iOS simulator. But I doesn't work now.

livnunes commented 4 years ago

Anyone found a solution for this, I'm currently using:

SmartArray commented 4 years ago

We have the same "issue". I did some investigations and I can tell you why it's impossible to get a logout working properly. It's not facebook's fault. Rather it is a security measure from Apple.

Here is why:

FBSDKCoreKit is using the most recent and recommended API provided by Apple: ASWebAuthenticationSession. It provides a secure and scoped session to login to third-party services, offering a secure callback to pass data back to the app.

As the ASWebAuthenticationSession is capsuled from the app, the biggest implications are: The app is unable to read/modify/delete the session data (passwords and login data) from the hardened WebView.

Here you can see the API call:

https://github.com/facebook/facebook-ios-sdk/blob/d5dc7380ddc0ea07fa4472c8384491cb366a3ae4/FBSDKCoreKit/FBSDKCoreKit/Internal/BridgeAPI/FBSDKBridgeAPI.m#L367

I thought of possible workarounds. For instance, using the same authentication session store to call the logout endpoint. However, the API would request this alert, which is an inappropriate use case:

Apples ASWebAuthenticationSession Sign In Alert

IMHO, there are only two methods to solve this issue:

Possible Workaround by Facebook

Either Facebook solves this by integrating a logout button in their OAuth modal form:

Facebook Oauth Form 'Sign In with another account' button proposal

Solution by Apple

Alternatively, Apple provides a secure way to clear cookies or web data from ASWebAuthenticationSession. Obviously, this wouldn't leak any privacy information at all, it would just interfere with the Single-Sign-On Feature. However, they could scope the Session Deletion with the URL that is being called by the API. Just saying.


Tl;dr Currently, there is no way to do achieve what we want.

ghost commented 3 years ago

I’m having the same issue. Log in dialog never prompts for email and password once the user logged in. Revoking permissions does no good.

Is there a workaround? I feel like it’s a big issue giving the user impression that he/she will and can never logs out.

Moreover, this logging out behavior might result in rejection in app review, and I don’t think it is fair.

leofolive commented 3 years ago

Anyone found any solution to this problem?

kyle-ssg commented 3 years ago

Assuming noone solved this? I'm guessing it's related to this https://github.com/facebookarchive/facebook-swift-sdk/issues/215

leofolive commented 3 years ago

Anyone found any solution to this problem?

SahilPawar1994 commented 3 years ago

if you are working on an iOS simulator and facing this issue, then you can reset your simulator using command xcrun simctl erase or xcrun simctl erase all this will erase all the data from your simulator, then run the app again, then you can do the login from another account.

victorbruce commented 3 years ago

xcrun simctl erase all

So far, this is the only solution that has helped me change the account to signing to Facebook. Thanks, @SahilPawar1994

saitejamalapati commented 3 years ago

Do we have any work around or any solution for this issue. We have tried clearing the cookies using @react-native-community/cookies when the user logs out of the app. But this didn't work in our case.

DangKhoi1997 commented 3 years ago

Any updates guys ???

pramitigupte commented 3 years ago

Did anyone find the solution?