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

后端 未结 17 2757
野的像风
野的像风 2020-11-29 18:52

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

相关标签:
17条回答
  • 2020-11-29 18:59

    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();
      }
      
    0 讨论(0)
  • 2020-11-29 19:00

    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.
    0 讨论(0)
  • 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!

    0 讨论(0)
  • 2020-11-29 19:04

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

    0 讨论(0)
  • 2020-11-29 19:05

    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
    
    0 讨论(0)
  • 2020-11-29 19:07

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

    0 讨论(0)
提交回复
热议问题