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

拥有回忆 提交于 2020-01-18 13:38:40

问题


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();
                        } 
                    }
                }
            }
        });

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

回答1:


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




回答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.



回答3:


This is the issue from Facebook. Confirmed by Facebook Team.

We will Expected Resolution: within 3 days




回答4:


For me, this exact error was due to invalid permission strings. Happened on iOS and Android.




回答5:


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

  • 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

That should fix the issue.




回答6:


This problem occurs because you've already authenticated the app via Facebook and your code may contain Authenticate every time Facebook (Find and Remove that).

Follow these steps:

  1. Go to Facebook settings.

  2. Remove your app.

  3. Make sure you've added Facebook Login in Facebook developer page and you've enabled Client OAuth Login.

  4. Go to your code and override the callback method:

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        mFacebookCallbackManager.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            Intent secondActivityIntent = new Intent(this, RedirectActivity.class);
            startActivity(secondActivityIntent);
        }
    }
    
  5. In the Oncreate method, call the AccessToken:

    accessTokenTracker = new AccessTokenTracker() {
        @Override
        protected void onCurrentAccessTokenChanged(
                AccessToken oldAccessToken,
                AccessToken currentAccessToken) {
            // Set the access token using
            // currentAccessToken when it's loaded or set.
        }
    };
    
    // If the access token is available already assign it.
    accessToken = AccessToken.getCurrentAccessToken();
    
    if (accessToken != null && !accessToken.isExpired())
    {
        GraphRequest request = GraphRequest.newMeRequest(accessToken, new GraphRequest.GraphJSONObjectCallback() {
            @Override
            public void onCompleted(JSONObject object, GraphResponse response) {
                if(null != object) {
                    try
                    {
                        Intent i = new Intent(MainActivity.this, Feedback.class);
                        startActivity(i);
                        String email = object.getString("email");
                        String birthday = object.getString("birthday");
    
                    }
                    catch (Exception ex)
                    {
                        Toast.makeText(MainActivity.this, ex.toString(), Toast.LENGTH_SHORT).show();
                    }
                } else {
                    // call your authentication process
    
                }
            }
        });
        Bundle parameters = new Bundle();
        parameters.putString("fields", "id,name,birthday,link");
        request.setParameters(parameters);
        request.executeAsync();
    }
    



回答7:


I had the same problem on my Redmi Note 3. Tested on Samsung. No problems. Wonder if it is Redmi specific.




回答8:


I was facing the same issue. I had my keyhashes defined perfectly, was still facing the same issue. I was not able to login even for the first time.

Solution to my problem was:

  1. Go to your app's dashboard here

  2. On the left pane, under products tab, ensure that you have Facebook Login added. If not, add it there.

If all your other configurations are in place. It works perfect after that.




回答9:


The problem for me is really with the hash key, It's not valid.

I had exactly the same problem and it was very hard to diagnose. The reason is that Facebook doesn't check the hash key at first login and it seems that the key is correct, but indeed it's not. Second, the error message is simply an idiocracy. Third is the resolution: try the following link, it helped me.

Better instructions to generate a valid hash key




回答10:


  1. Remove app from user settings in Facebook (account).

  2. Uninstall the app.

  3. Get the new hash using the release or new debug keystore. Use this command:

    keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
    
  4. Add the new hash on Facebook dashboard.




回答11:


I faced the same problem.

It was a mistake on my side.

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64

When typed this command, it prompted Enter keystore password:. I was giving the keyPassword instead storePassword and it didn't gave any error message instead generated a different hash!




回答12:


I faced the same issue and I found that the hash key which I have generated to put in facebook developer console is not proper. I tried to generate hash key from different PC and it asked me to enter password for that particular keystore which was not the case in my PC. So make sure that you will asked to enter key store password while creating hash key then insert that hash key into facebook developer console.

Command to generate hash key:

keytool -exportcert -alias TYPE ALIAS HERE -keystore KEY_STORE_FILE_PATH_HERE | openssl sha1 -binary | openssl base64



回答13:


I had the same problem today on my sites and then realised that I was using the old default_graph_version = v3.2. I've changed it to the latest:

default_graph_version = v4.0

Now everything works again. Give it a try.




回答14:


I refer this,

https://developers.facebook.com/docs/android/getting-started

or just add below code in onCreate() method, which will return key hash.

 // Add code to print out the key hash
try {
    PackageInfo info = getPackageManager().getPackageInfo(
            "com.facebook.samples.hellofacebook", 
            PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
} catch (NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}

Add above code to retrieve key,that key you can store

https://developers.facebook.com/docs/facebook-login/android

here. Now It will work.

It worked for me, hope will work for you too.

OR

This command may not give you latest keyhash.

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64

To get latest or active keyhash from android studio search hash in your android studio's Logcat or android monitor while app is running and throwing above error. You will get different keyhash which is active. After pasting this searched keyhash in your console setting you may log be able to your app.



来源:https://stackoverflow.com/questions/39051517/login-error-there-is-an-error-in-logging-you-into-this-application-please-try

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!