Open thisisbalaG opened 5 years ago
me too
Ran into this, I believe it occurred when the Facebook app was on the Android device and signed in.
Facing same issue right now. This is occurring only on Android if the facebook application is installed on device.
Not sure if this is the same issue as well, but been stuck on this screen (for android) after login and can't find a fix
React Native Environment Info: System: OS: Linux 4.4 Ubuntu 18.04.1 LTS (Bionic Beaver) CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz Memory: 724.09 MB / 7.89 GB Shell: 4.4.19 - /bin/bash Binaries: Node: 10.15.3 - /usr/bin/node npm: 6.4.1 - /usr/bin/npm npmPackages: react: 16.8.3 => 16.8.3 react-native: ^0.59.9 => 0.59.9 npmGlobalPackages: react-native-cli: 2.0.1
Hey guys, haven’t tried this yet but since it seems the issue is the native Facebook app. You could try setting the Login mode to web only so that it ignores the native app, as a workaround.
Hey guys, haven’t tried this yet but since it seems the issue is the native Facebook app. You could try setting the Login mode to web only so that it ignores the native app, as a workaround.
I'm pretty sure that this approach should not be considered as proper solution of the problem but I would definitely like to try this. Let me know if you have any tutorial/guide reference for this approach.
@abhi-nahi Correct, not a proper solution and hopefully this issue get fixed. Here's some more info on setting LoginBehavior https://stackoverflow.com/questions/39835006/how-do-i-set-loginbehaviour-when-using-react-native-fbsdk-loginmanager/47267836
You can pass this as a prop to LoginButton also to see which login types are working
@jordangrant Thanks, This thing works but still the question remains same. Why would anyone enter their credentials again if they already have Facebook installed ??
I had the same problem and solved like this, setting loginBehavior only for web, like the code below:
if (Platform.OS === "android") {
LoginManager.setLoginBehavior("web_only")
}
await LoginManager.logInWithPermissions(["public_profile", "email"])
I dont know why, but when you have facebook app installed react-native-fbsdk try to login with then, and nothing happen.
@abhi-nahi They wouldn't. Hence the bug report. My current workaround defaults to Web and allows user to manually change to native. If I leave it as native some people can't access my app.
{Platform.OS === 'android' &&
<Text onPress={() => this.toggleLoginMode()}>
{(this.state.loginMode == 'web_only' ? 'Login via Web (Tap to change)' : 'Login Automatically (FB App)')}
</Text>}
<LoginButton
loginBehaviorAndroid={this.state.loginMode}
...
Hi guys, any solution yet, I am experiencing the same with 1.0.3
and 1.0.4
I found a solution for this guys. Use this stable version "react-native-fbsdk": "^1.0.2". and add correct Hash keys for both development and release mode. It will work. Hope this helps.
@thisisbalaG that doesn't support IOS 13
@yasir-netlinks I have a temporary solution for this. Since you cannot use separate versions of this library for android and iOS, Inside your node modules inside ./ios folder replace the RCTFBSDK and RCTFBSDK.xcodeproj from a lower version file in the library version "react-native-fbsdk": "^0.10.1". This will work
+1 i had the same problem :(
same issue
@janicduplessis any chance this will get a fix soon. Makes this library pretty unusable on android.
In Build apk login with facebook worked but when I prepare release apk, in release apk login with facebook throw error as thisisbalaG said I also put build & release a hash key.
I had the same problem and solved like this, setting loginBehavior only for web, like the code below:
if (Platform.OS === "android") { LoginManager.setLoginBehavior("web_only") } await LoginManager.logInWithPermissions(["public_profile", "email"])
I dont know why, but when you have facebook app installed react-native-fbsdk try to login with then, and nothing happen.
Working in current version of RN and SDK
Yes but thats a current workaround but not a solution. People should be able to log in with the Facebook app without reentering their password.
I had the same problem and solved like this, setting loginBehavior only for web, like the code below:
if (Platform.OS === "android") { LoginManager.setLoginBehavior("web_only") } await LoginManager.logInWithPermissions(["public_profile", "email"])
I dont know why, but when you have facebook app installed react-native-fbsdk try to login with then, and nothing happen.
This is a temporary workaround, I hope a solution will be found.
same issue, not cool that people reenter their password :/
if (Platform.OS === "android") { LoginManager.setLoginBehavior("web_only") } Const result = Await LoginManager.logInWithReadPermissions(['public_profile', 'email']);
if (result.isCancelled) {
ToastAndroid.show("User cancelled request ", ToastAndroid.SHORT)
console.log('User cancelled request');
}
else{ Const data = Await AccessToken.getCurrentAccessToken();
if (!data) {
console.log('Something went wrong obtaining the users access token');
}
//here logincredential code
}### Its working for me
The issue is not that it's not working when using web-only
but that it doesn't work without it. And users should not be forced to enter a password again.
even when set to web_only behavior, in safari it opens up the browser and there is an option to login from the app by facebook so when the user tries that I does not work again :/
That error occurred because of using invalid hash key in Facebook Developer. You need to export hash key by using the below command, then update generated hash key (28 characters) into https://developers.facebook.com/ under Settings-> Basic -> Android HashKeys
keytool -exportcert -alias ADD_RELEASE_KEY_ALIASE_HERE -keystore ADD_UR_KEYSTORE_PATH_HERE | openssl sha1 -binary | openssl base64
@ngtan , thanks man. So I need to create a new hash key with my release key store? What should I do with the old one that is already there in facebook developer?
I understand your command for generating key hash, can you give a full example. Just wanted to see how does it look after adding key alias and key store path. Thanks a lot.
@Saad-Bashar it's mine from FB developer.
@ngtan , I meant the cli command
Any update on this?
Any update on this??
me tooo
Any update on this??
Hello @Saad-Bashar,
FYI, here are my commands for generating hash key
keytool -exportcert -alias androiddebugkey -keystore YOUR_PROJECT/android/app/debug.keystone | openssl sha1 -binary | openssl base64
keytool -exportcert -alias androidreleasekey -keystore YOUR_PROJECT/android/app/YOUR_RELEASE_FILE.keystone | openssl sha1 -binary | openssl base64
After got hash key from cli, just put them in FB developer as the image below
I put 2 hash keys for both debug and release in FB developer.
Hello @Saad-Bashar, FYI, here are my commands for generating hash key
keytool -exportcert -alias androiddebugkey -keystore YOUR_PROJECT/android/app/debug.keystone | openssl sha1 -binary | openssl base64
keytool -exportcert -alias androidreleasekey -keystore YOUR_PROJECT/android/app/YOUR_RELEASE_FILE.keystone | openssl sha1 -binary | openssl base64
After got hash key from cli, just put them in FB developer as the image below
I put 2 hash keys for both debug and release in FB developer.
Just did this with both of your commands and the error persists :(
Can’t you discuss these completely unrelated things in a different issue or on stack overflow. This is exactly the reason why library maintainers drown in issues that it’s impossible to u der Stand what they are about.
Hello @Saad-Bashar, FYI, here are my commands for generating hash key
keytool -exportcert -alias androiddebugkey -keystore YOUR_PROJECT/android/app/debug.keystone | openssl sha1 -binary | openssl base64
keytool -exportcert -alias androidreleasekey -keystore YOUR_PROJECT/android/app/YOUR_RELEASE_FILE.keystone | openssl sha1 -binary | openssl base64
After got hash key from cli, just put them in FB developer as the image belowI put 2 hash keys for both debug and release in FB developer.
Just did this with both of your commands and the error persists :(
Note that, androiddebugkey
and androidreleasekey
are your key alias for both dev and prod environment.
Following theses steps solved my problem: https://github.com/facebook/react-native-fbsdk/issues/424#issuecomment-469047955
If you already uploaded your app to the playstore and enabled "app signing by Google Play" there is a solution (at least this worked for me):
That should fix the issue.
Great but all of this is completely unrelated to the topic of this issue.
@MrLoh
That is not true. It is related to the topic.
I got the exact same error message and this is what I did to fix it. How is that unrelated?
@tafelnl So you can now login without web_only login behavior on Android?
@MrLoh
Yes, when the Facebook app is installed, it will make use of it.
@tafelnl thank you for the clear answer that this actually is related to the original issue and not a separate one as the original comment by Saad-Bashar suggested:
even when set to web_only behavior, in safari it opens up the browser and there is an option to login from the app by facebook so when the user tries that I does not work again :/
The issue is indeed solved by updating the key hashes. This probably happened to a lot of people, since the latest react native version changed the setup of the debug keystore.
@MrLoh You're welcome. Happy coding :)
Thanks guys for the response. @tafelnl I am having one issue. After converting the sha-1 from my play console the base64 output that I get is incorrect in facebook developer key hashes. Am I doing something wrong? When I convert I do not get the = sign at the end of the string.
Update: Now I did it correctly. But still getting the same error in debug build. Do I need to delete the previous one?
@Saad-Bashar for debug you also need a debug key and not a release key as far as I am aware. I don't think app signing by google play store supports this. So you have to fall back to the keytool way. Here is a good explanation even for rookies: https://stackoverflow.com/a/46241386/8634342
I don't know why, but for me, the hash that FBSDK got for the release build scheme app is not the same that you get with keytool/openssl. What helped me is looking at the "adb logcat" output (just after attempting to log in) where I found:
BlueServiceQueue: X.2NP: [code] 404 [message]: Key hash %YOUR KEY HASH HERE% does not match any stored key hashes. (404) [extra]: null
and i used that hash for the fb console
Solution provided by @tafelnl works, though I used simpler way to get the hashes:
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64
This code is provided by Facebook in their Quickstart guide. Just make sure you're using correct value for your keystore password! This code generates different hashes if you provide different passwords and does not fail if you provide incorrect password.
@urvashikharecha
You should not use that method, as it provides really bad User Experience and seems not to be needed anymore. Please refer to my solution (https://github.com/facebook/react-native-fbsdk/issues/633#issuecomment-554335094) or the one @hbarylskyi mentioned at https://github.com/facebook/react-native-fbsdk/issues/633#issuecomment-571956106
Hi,
I have followed the instructions properly and i got this error while i signed in into the app and did the facebook login.
This issue am getting is in android.
Please help