Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Login Error : there is an error in logging you into this application. please try again later. #633

Open
thisisbalaG opened this issue Aug 28, 2019 · 72 comments

Comments

@thisisbalaG
Copy link

thisisbalaG commented Aug 28, 2019

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
facebook login error

@maslhiro
Copy link

me too

@jordangrant
Copy link

Ran into this, I believe it occurred when the Facebook app was on the Android device and signed in.

@abhi-nahi
Copy link

Facing same issue right now. This is occurring only on Android if the facebook application is installed on device.

@naimoon6450
Copy link

naimoon6450 commented Aug 30, 2019

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

image

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

@jordangrant
Copy link

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.

@abhi-nahi
Copy link

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.

@jordangrant
Copy link

jordangrant commented Aug 30, 2019

@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

@abhi-nahi
Copy link

@jordangrant Thanks, This thing works but still the question remains same. Why would anyone enter their credentials again if they already have Facebook installed ??

@yanguyt
Copy link

yanguyt commented Sep 5, 2019

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.

@jordangrant
Copy link

@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}
...

@yasir-netlinks
Copy link

yasir-netlinks commented Sep 19, 2019

Hi guys, any solution yet, I am experiencing the same with 1.0.3 and 1.0.4

@thisisbalaG
Copy link
Author

thisisbalaG commented Sep 19, 2019

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.

@yasir-netlinks
Copy link

@thisisbalaG that doesn't support IOS 13

@thisisbalaG
Copy link
Author

@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

@ducpt2
Copy link

ducpt2 commented Oct 9, 2019

+1 i had the same problem :(

@Saad-Bashar
Copy link

same issue

@MrLoh
Copy link

MrLoh commented Oct 17, 2019

@janicduplessis any chance this will get a fix soon. Makes this library pretty unusable on android.

@DevAelius
Copy link

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.

@alexnaldo
Copy link

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

@MrLoh
Copy link

MrLoh commented Oct 20, 2019

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.

@ahmadsdk
Copy link

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.

@jessk77
Copy link

jessk77 commented Oct 24, 2019

same issue, not cool that people reenter their password :/

@csnindreamer
Copy link

csnindreamer commented Oct 25, 2019

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

@MrLoh
Copy link

MrLoh commented Oct 25, 2019

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.

@Saad-Bashar
Copy link

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 :/

@ngtan
Copy link

ngtan commented Oct 27, 2019

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

@Saad-Bashar
Copy link

@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.

@ngtan
Copy link

ngtan commented Oct 28, 2019

@Saad-Bashar it's mine from FB developer.
Screen Shot 2019-10-28 at 11 08 54 AM

@tafelnl
Copy link

tafelnl commented Nov 21, 2019

@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

@thedukeatreides
Copy link

thedukeatreides commented Dec 6, 2019

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

@hbarylskyi
Copy link

hbarylskyi commented Jan 8, 2020

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.

@tafelnl
Copy link

tafelnl commented Jan 10, 2020

@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 (#633 (comment)) or the one @hbarylskyi mentioned at #633 (comment)

@DuaneQ
Copy link

DuaneQ commented Feb 23, 2020

@ngtan
I think my issue began when i upgraded Android Studio. I'm having issues signing in with Google Authentication and Facebook on Android with my Ionic app...and i think it's my key has from everything I've read. But I have no idea what I'm doing wrong...I'm generating the hash exactly as you've said but nothing will work for Android...Google or Facebook authentication. I don't know where to begin at this point...I've tried everything. I even tried creating a new project and the same thing happened. Is it possible the wrong key hash is being compiled in the apk file during build?

@phithu
Copy link

phithu commented Feb 29, 2020

@tafelnl thanks for sharing. It work for me

@patrickbussmann
Copy link

For me its not working. And I have the same issue on iOS, too.

I added the hash to Facebook then the issue with adding keys is gone and the other one appears.
Dont know how to solve it.

92511732_2527810857323032_4678004329272049664_n

And after I added the key like @tafelnl mentioned.

92299865_2897290383684966_8286251168330416128_n

@kindacoder
Copy link

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):

  • login into you play console
  • click on the app
  • now on the left side click "release management"
  • click "App signing"
  • under "App signing certificate" copy the SHA-1 certificate fingerprint
  • go to http://tomeko.net/online_tools/hex_to_base64.php
  • paste the SHA-1 in the first field
  • copy the text in input field under "Output (base64)"
  • now open developer.facebook.com/apps
  • click your app
  • on the left side navigate to "Settings" -> "Basic"
  • past the Base64 text here under key hashes
    image

That should fix the issue.

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):

  • login into you play console
  • click on the app
  • now on the left side click "release management"
  • click "App signing"
  • under "App signing certificate" copy the SHA-1 certificate fingerprint
  • go to http://tomeko.net/online_tools/hex_to_base64.php
  • paste the SHA-1 in the first field
  • copy the text in input field under "Output (base64)"
  • now open developer.facebook.com/apps
  • click your app
  • on the left side navigate to "Settings" -> "Basic"
  • past the Base64 text here under key hashes
    image

That should fix the issue.

I can not see the SHA-1 certificate fingerprint. I can see this screen. Did I miss something? I have released the app into beta mode.Please help
Screenshot 2020-04-30 at 10 54 16 AM

@JoaoMartins1930
Copy link

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):

  • login into you play console
  • click on the app
  • now on the left side click "release management"
  • click "App signing"
  • under "App signing certificate" copy the SHA-1 certificate fingerprint
  • go to http://tomeko.net/online_tools/hex_to_base64.php
  • paste the SHA-1 in the first field
  • copy the text in input field under "Output (base64)"
  • now open developer.facebook.com/apps
  • click your app
  • on the left side navigate to "Settings" -> "Basic"
  • past the Base64 text here under key hashes
    image

That should fix the issue.

This works, but ony when i'm in development mode. When I release the sdk and install it in my smartphone, the problem shows again? Do you know why?

@kindacoder
Copy link

This works, but ony when i'm in development mode. When I release the sdk and install it in my smartphone, the problem shows again? Do you know why?

I think because maybe you are using debug SHA-1, please use Release SHA-1 if that is the case.

@JoaoMartins1930
Copy link

This works, but ony when i'm in development mode. When I release the sdk and install it in my smartphone, the problem shows again? Do you know why?

I think because maybe you are using debug SHA-1, please use Release SHA-1 if that is the case.

The SHA-1 that I was using was the only one in the firebase console, there's no debug and release. But now I tried the SHA-1 loading certificate which I found in Google Play Console and now it works. I don't now if it is the best or right way to do it, but in fact it works.

@kindacoder
Copy link

kindacoder commented Apr 30, 2020

This works, but ony when i'm in development mode. When I release the sdk and install it in my smartphone, the problem shows again? Do you know why?

I think because maybe you are using debug SHA-1, please use Release SHA-1 if that is the case.

The SHA-1 that I was using was the only one in the firebase console, there's no debug and release. But now I tried the SHA-1 loading certificate which I found in Google Play Console and now it works. I don't now if it is the best or right way to do it, but in fact it works.

SHA-1 you used is release level SHA-1 (you uploaded release build on play store) that is why it worked :)

@aungmyooo2k17
Copy link

The error occurs because of invalid hash key.

We can create Hash key using the below command and update the same here under Settings-> Basic -> Android HashKeys

keytool -exportcert -alias ADD_RELEASE_KEY_ALIASE_HERE -keystore ADD_UR_KEYSTORE_PATH_HERE | openssl sha1 -binary | openssl base64

You can find the Relase Key Alias of your keystore using the below command if needed:

keytool -list -keystore ADD_UR_KEYSTORE_PATH_HERE

I have also experience an issue like by using the above HashKey the login works fine if I install the release APK directly to the device, But when I upload the APK to Play Store and install app from store then it shows the same Login failed error. The fix for this is as follows:

Go to Release Management here
Select Release Management
 -> App Signing
You can see SHA1 key in hex format App signing certificate.

Copy the SHA1 in hex format and convert it in to base64 format, you can use this link do that without the SHA1: part of the hex.

Go to Facebook developer console and add the key(after convert to base 64) in the settings —> basic –> key hashes.

source => https://stackoverflow.com/questions/39051517/login-error-there-is-an-error-in-logging-you-into-this-application-please-try/56952547#56952547

@mifi
Copy link

mifi commented May 14, 2020

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):

  • login into you play console
  • click on the app
  • now on the left side click "release management"
  • click "App signing"
  • under "App signing certificate" copy the SHA-1 certificate fingerprint
  • go to http://tomeko.net/online_tools/hex_to_base64.php
  • paste the SHA-1 in the first field
  • copy the text in input field under "Output (base64)"
  • now open developer.facebook.com/apps
  • click your app
  • on the left side navigate to "Settings" -> "Basic"
  • past the Base64 text here under key hashes
    image

That should fix the issue.

For those who don't want to paste their hashes into an online tool, here's a oneliner Node.js command to do the same:

node -e 'console.log(Buffer.from(process.argv[1].split(":").map(hex => parseInt(hex, 16))).toString("base64"))' '5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25'

outputs:

Xo8WBi6jzSxKDVR4drqm84yr9iU=

@JoaoMartins1930
Copy link

JoaoMartins1930 commented May 14, 2020

The error occurs because of invalid hash key.

We can create Hash key using the below command and update the same here under Settings-> Basic -> Android HashKeys

keytool -exportcert -alias ADD_RELEASE_KEY_ALIASE_HERE -keystore ADD_UR_KEYSTORE_PATH_HERE | openssl sha1 -binary | openssl base64

You can find the Relase Key Alias of your keystore using the below command if needed:

keytool -list -keystore ADD_UR_KEYSTORE_PATH_HERE

I have also experience an issue like by using the above HashKey the login works fine if I install the release APK directly to the device, But when I upload the APK to Play Store and install app from store then it shows the same Login failed error. The fix for this is as follows:

Go to Release Management here
Select Release Management
 -> App Signing
You can see SHA1 key in hex format App signing certificate.

Copy the SHA1 in hex format and convert it in to base64 format, you can use this link do that without the SHA1: part of the hex.

Go to Facebook developer console and add the key(after convert to base 64) in the settings —> basic –> key hashes.

source => https://stackoverflow.com/questions/39051517/login-error-there-is-an-error-in-logging-you-into-this-application-please-try/56952547#56952547

I had the same problem. Thanks!!

@deepakdreamworks
Copy link

Set LoginBehavior if you have installed facebook app in your phone loginButton.setLoginBehavior(LoginBehavior.WEB_ONLY);

@deepakdreamworks
Copy link

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
facebook login error

Set LoginBehavior if you have installed facebook app in your phone loginButton.setLoginBehavior(LoginBehavior.WEB_ONLY);

@robertqin86
Copy link

robertqin86 commented Jun 1, 2020

This is the proper solution if your app is live on the store and you're using app signing. The method to generate your release key hash (in FB hopelessly outdated documentation) does not apply to you.

DO NOT USE THIS TO GENERATE HASH IF YOU'RE USING APP SIGNING :
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64

Instead, do this:

  1. Go to Release Management in your Google Play Console
  2. Select App Signing in Release Management
  3. You can see SHA1 key in hex format App signing certificate.
  4. Copy the SHA1 in hex format and convert it in to base64 format, you can use link. Do that without the SHA1: part of the hex.
  5. Go to Facebook developer console and add the key(after convert to base 64) in the settings —> basic –> key hashes.

Answer credit to Nadhir Falta from Android Facebook SDK: generate release key hash

Credit also goes to tafelnl for giving a similar solution . But I thought what was missing was the clarity to remove the SHA1 part of the hex.

@kindacoder
Copy link

kindacoder commented Jun 1, 2020

This is the proper solution if your app is live on the store and you're using app signing. The method to generate your release key hash (in FB hopelessly outdated documentation) does not apply to you.

DO NOT USE THIS TO GENERATE HASH IF YOU'RE USING APP SIGNING :
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64

Instead, do this:

  1. Go to Release Management in your Google Play Console
  2. Select App Signing in Release Management
  3. You can see SHA1 key in hex format App signing certificate.
  4. Copy the SHA1 in hex format and convert it in to base64 format, you can use link. Do that without the SHA1: part of the hex.
  5. Go to Facebook developer console and add the key(after convert to base 64) in the settings —> basic –> key hashes.

Answer credit to Nadhir Falta from Android Facebook SDK: generate release key hash

Credit also goes to tafelnl for giving a similar solution . But I thought what was missing was the clarity to remove the SHA1 part of the hex.

Hi @robertqin86 , I am not able to see any SHA1 key in my release management console. instead it's asking me upload. what to do in this case ? see this screenshot for reference #633 (comment)

@Mayank-U
Copy link

Mayank-U commented Jun 17, 2020

This worked for me.

Copy the APK to your PC in Program Files\java\jdkX.X.X_XXX\bin folder

In my case it's C:\Program Files\Java\jdk1.8.0_191\bin

Open CMD in this directory and type the following

keytool -list -printcert -jarfile YOUR_APK_NAME.apk

Copy the SHA1 value to your clipboard It will be something like this: 79:D0:E6:80:4E:28:1E:D1:88:28:CB:D7:E6:BE:2E:0C:FB:24:98:52

Then go to http://tomeko.net/online_tools/hex_to_base64.php to convert your SHA1 value to base64.

This is what Facebook requires get the generated hash " ********************= " and copy the key hash to your Facebook developers app settings.
Generate your key like this & try again.
#Ovi Thank you.

@wadejohnson650
Copy link

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.

@ahmadsdk I've used your solution and it is working fine, i would like to know if there are any long term problems associated with this method ?

@Mayank-U I tried your solution but the resultant hash key was already on the facebook developers app settings, it was working fine with the codes but it just started throwing this error and i cannot pinpoint the exact reason , some feedback on this issue would be welcome.

@nguyenhoanglam
Copy link

I confirm @robertqin86 solution works magically !!!

@r0b0t3d
Copy link

r0b0t3d commented Aug 18, 2020

I got this problem in dev mode, the problem cause by wrong key hash.
If you got this problem while developing. Please make sure you are generating the key hash from the right debug.keystore file. There is one inside <your_project>/android/app/debug.keystore

keytool -exportcert -alias androiddebugkey -keystore <your_project>/android/app/debug.keystore | openssl sha1 -binary | openssl base64

In facebook documentation, they generate from ~/.android/debug.keystore. so that is the difference

@claudiomerli
Copy link

claudiomerli commented Sep 18, 2020

Hi guys, I also faced this problem and i'he not resolved yet... I've correctly configured the hash key, obtained from SHA-1 fingerpring inside the App signing certificate section on Google Play and http://tomeko.net/online_tools/hex_to_base64.php, inside Facebook developer console, but the problem still persist. Someone has some ideas?

@MannySauce
Copy link

Hello, I'm also facing this issue. I have made sure to generate the hash keys in the right directory, aswell as pasting and saving the generated hash keys in the FB developers platform.

My app is still in devmode, it belongs to the business and pages category. Under app purposes: 'Yourself or your own business'. On iOS the native FB login works correctly without fail, but on android it only works when login behavior is set to 'web_only'. When I try it the native FB login way... it gives the login error mentioned in the title of this question. Oddly everytime I generate a new hash key on my computer the same one comes out which is: Xo8WBi6jzSxKDVR4drqm84yr9iU= just like the one @mifi mentions.. I thought it would generate a different one for everybody everytime but I guess it doesn't..

Anyway I hope a fix comes out for this soon.. Im using react native 0.61.5 and react-native-fbsdk 3.0.0. lib. Any info at all is apreciated thanks.

@glyphCezilleSantillan
Copy link

Getting this issue too; the hash workaround fixed it for some of my testers but not all of them. Would appreciate any updates.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests