Login Error: There is an error in logging you into this application. Please try again later

111,307

Solution 1

I also Face this problem .Update your key hash on Facebook

Solution 2

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:

  1. Go to Release Management here

  2. Select Release Management → App Signing

  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 this 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

Solution 3

ANSWER

Just throwing this out there for people still experiencing this issue. The hash I created through the keytool was somehow incorrect. I fixed it by doing the following:

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

  1. Login into the Google Play Console
  2. Click on the app you want the hash from
  3. Now, open the navigation on the left hand side
  4. Under Release click Setup > App integrity Navigation drawer in the Google Play Console
  5. Under App signing certificate copy the SHA-1 certificate fingerprint
  6. Go to http://tomeko.net/online_tools/hex_to_base64.php
  7. Paste the SHA-1 in the first field
  8. Copy the text in input field under Output (base64)
  9. Now open developer.facebook.com/apps
  10. Navigate to the dashboard of your app (My Apps > Your App Name)
  11. On the left side navigate to Settings > Basic
  12. Paste the Base64 text here under Key Hashes enter image description here

That should fix the issue.


UPDATE

The steps above should still fully work.

But if you do not want to paste your key on that website, here is an alternative to step 6,7,8 below:

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'

credits: mifi


Solution 4

enter image description here

enter image description hereFnnK.jpg

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

Solution 5

  1. Generate .apk file
  2. open a terminal where .apk file exists
  3. to keep in your mind that you have to generate two separate SHA1 keys for release and debug. e-g just run following command with debug.apk and release.apk
  4. run keytool -list -printcert -jarfile yourapkname.apk
  5. you will get

MD5: 00:00:A0:00:00:00:72:00:00:B9:00:00:00:3D:00:00

SHA1: 00:00:94:00:67:00:FA:00:4E:00:CE:80:00:1A:00:00:00:00:00:00

SHA256: 00:00:00:34:00:00:00:00:00:00:00:00:00:00:00:00:56:00:F5:00:00:49:00:4A:00:00:00:00:00:00:00:00

  1. copy SHA1 open http://tomeko.net/online_tools/hex_to_base64.php
  2. past in Hex string your Key Hash will be in Output (base64)
  3. copy your Key Hash and add in your App setting on developers.facebook.com
Share:
111,307
Naveen Kumar M
Author by

Naveen Kumar M

Senior Solutions Architect ಎಲ್ಲಾದರು ಇರು ಎಂತಾದರು ಇರು ಎಂದೆಂದಿಗು ನೀ ಕನ್ನಡವಾಗಿರು! ಕನ್ನಡವೇ ಸತ್ಯ ಕನ್ನಡವೇ ನಿತ್ಯ.

Updated on July 05, 2022

Comments

  • Naveen Kumar M
    Naveen Kumar M almost 2 years

    I am getting this error. When I try to sign in with facebook to my app. When I first time authentication it will correctly working. After I unistalled my application and now trying to sign in with Facebook on that I am getting this error.

    Another Issue : After authenticate in device1 and try to login with facebook on device2 also same error is getting.

    Solution I Found : when I remove App authentication from Facebook App Settings it is working in above scenario's but this is not an good solution how we can tell to users to do this action?

    btnFbLogin.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if(accessToken != null) {
                        boolean expires = accessToken.isExpired();
                        if(!expires) {
                            performFbLoginOrSignUp(accessToken);
                        }
                    } else {
                        LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
                        callbackManager = CallbackManager.Factory.create();
    
                        if (loginButton != null) {
                            loginButton.setReadPermissions("public_profile", "email", "user_friends");
    
                            if (CommonUtil.isConnectingToInternet(LoginActivity.this)) {
                                loginButton.performClick();
    
                                loginButton.setPressed(true);
    
                                loginButton.invalidate();
    
                                loginButton.registerCallback(callbackManager, mCallBack);
    
                                loginButton.setPressed(false);
    
                                loginButton.invalidate();
                            } 
                        }
                    }
                }
            });
    

    Error page

    In Facebook example also having an issue : GitHub link of Facebook example

    Steps to reproduce :

    1. Launch the app Login with Facebook Authenticate FB profile.

    2. Un_install the app and install again.

    3. Now try to Login with Facebook.

    4. The above error will occur. because we already authenticated so need to access fb profile. but here we facing the issue.
    5. Here already authenticated page is not showing.
    6. I am using Native FB app with the device Xiaomi Redmi Note 3
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    I already overridden access tracker. But not resolving my issue
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    I am already updated key hash. For you after update key hash is the problem resolved?
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    But for me not resolved. Check this link developers.facebook.com/bugs/297086380683342 Here so many members facing same issue. I provides steps to reproduce please follow the steps to reproduce.
  • Lokesh Mehta
    Lokesh Mehta over 7 years
    Which sdk version you are use
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    Before :com.facebook.android:facebook-android-sdk:4.0.0 Now : com.facebook.android:facebook-android-sdk:4.14.1 In both SDK version having an issue
  • jerbotron
    jerbotron over 7 years
    does anyone know if I should remove my old debug hash keys once I generated my release hash key on facebook?
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    After updating new hash key also having same problem
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    Yes It will occurs in Redmi Note 3. I checked in Nexus Its works fine
  • Anjum....
    Anjum.... over 7 years
    Mee to i am testing on Redmi Note3 :)
  • Ben Looi
    Ben Looi over 7 years
    I think it has to do with Redmi ROM or some settings. The Miui forum is down. Tried to allow window pop up in security settings for facebook. Didnt work.
  • NineToeNerd
    NineToeNerd over 7 years
    I just commented on the bug linked by @Naveen above. "Did any of the other people experiencing this bug have to type in a password to get their debug key hash? I didn't have to on the Mac I was using when following the Facebook tutorial. Then I got home, and I looked up how to get the hash on Linux. I had to type in the password "android" this time, and after putting this key into the developer console on Facebook, I was able to use the log in/out feature correctly."
  • Ben Looi
    Ben Looi over 7 years
    I am trying to get console and server log from xiaomi note. The English forum en.miui.com is down. Not a fb connect bug but a redmi bug. :(
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    @NineToeNerd thanks for your comment. But this problem not related to Hash Key. Its completely related to Facebook Native app. Its currectly working in some devices like Nexus , Samsung. But issue with Red Mi Phones
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    First time I authenticated successfully. When I Uninstall and install now try to access Fb Login now AccessToken.getCurrentAccessToken() is null. Its not null in nexus devices right now issue is facing on Redmi devices and some of the samsung devices also.
  • Naveen Kumar M
    Naveen Kumar M over 7 years
    In Facebook Fixed error. Actual error message was sending wrong from Facebook. Now they found that and fixed and sending as Invalid Hash Key error. I Created a new hash key for debug and release now Its working fine. Thanks for your answer
  • Ganesh AB
    Ganesh AB over 6 years
    Are you sure about this? Is this issue resolved now?
  • Naveen Kumar M
    Naveen Kumar M over 6 years
    Yes it was resolved on that instance. But not sure about now. If you having any issue raise the bug in developers.facebook.com/bugs
  • Morgan Koh
    Morgan Koh almost 5 years
    It'll save you time if you can just get the keyhash from your packageManager instead. stackoverflow.com/a/56388262/2867351
  • Kishore Kumar
    Kishore Kumar over 4 years
    This is the perfect answer , it happens
  • Osama Ibrahim
    Osama Ibrahim over 4 years
    Many Thanks, you save my day
  • Ketan Ramani
    Ketan Ramani over 4 years
    Try this solution if none of the solution listed in this page is not working: stackoverflow.com/a/59316144/6667442
  • D.Hodges
    D.Hodges about 4 years
    @MorganKoh is there a way to do this if you're building an Ionic App?
  • jack_07
    jack_07 about 4 years
    Mine issue is , it is working in some devices and not working in other devices (Samsung, Redmi). After putting key into developers console, app is crashing for specific devices (Samsung, Redmi)
  • Abhijit Kurane
    Abhijit Kurane almost 4 years
    Fixed this issue by following the steps you mentioned. Lot thanks, you saved my time :-)
  • Krunal Shah
    Krunal Shah almost 4 years
    My app is not released, it is still in under development. I am creating the release build and also create release Keystore and generate a sha1 hash key using release Keystore. But still I am not able to log in, if the Facebook app is installed, without facebook app from web login dialog its working. Please help me to solve it. @SumiSadic
  • Otuyh
    Otuyh almost 4 years
    This one was the ONLY ANSWER to solve my problem. I'm executing EXACTLY the steps told in facebook getting started, but still failing. I have this problem for years, and still today, the only code that works is that hex to base64 site gives.
  • ACAkgul
    ACAkgul almost 4 years
    this must be joke, same issue was here and i resolved by your solution, thanks !
  • Odai A. Ali
    Odai A. Ali over 3 years
    Your answer solved My Issue with this stubborn Facebook Error
  • avisper
    avisper about 3 years
    best solution! works perfect. Independent, if user has an updated facebook app or problems like that
  • Arun Wilson
    Arun Wilson about 3 years
    Thanks @Rasheed Qureshi, tried all methods, but your method save me.
  • Ali Yar Khan
    Ali Yar Khan over 2 years
    do i have to put my upload-keystore.jks file too in the app folder ?
  • HandyPawan
    HandyPawan over 2 years
    Great answer buddy!
  • Junkkung HangHeng
    Junkkung HangHeng over 2 years
    I have spent a few day to sloved this problem. This comment is very useful and I suggest this comment in github too. github.com/AntonioCuevaUrraco/nativescript-facebook-login/…. And try to run gradlew signingReport or ./gradlew signingReport at android root project and find something xx-release then compare SHA1 with above method in github you will understand when you see it. This might help you. ;)
  • Narcis
    Narcis about 2 years
    Thank you for this, it saved me! Note that you need to follow the steps of going to Release Management → App Signing only if you chose Google to handle app signing for you (which is anyways recommended).