title: Facebook log in giving exception "SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: null"
body: <p>What I have done so far..</p>
  
  <pre><code>&lt;meta-data
          android:name="com.facebook.sdk.ApplicationId"
          tools:replace="android:value"
          android:value="@string/facebook_app_id" /&gt;
  
      &lt;activity
          android:name="com.facebook.FacebookActivity"
          android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:label="@string/app_name" /&gt;
      &lt;activity
          android:name="com.facebook.CustomTabActivity"
          android:exported="true"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.VIEW" /&gt;
  
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
  
              &lt;data android:scheme="@string/fb_login_protocol_scheme" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  </code></pre>
  
  <p>Code
  onCreate</p>
  
  <pre><code>loginButton = findViewById(R.id.login_button_fb);
      callbackManager = CallbackManager.Factory.create();
      findViewById(R.id.login_button).setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              signInWithFacebook();
          }
      });
  
      getInstance().registerCallback(callbackManager,
              new FacebookCallback&lt;LoginResult&gt;() {
                  @Override
                  public void onSuccess(LoginResult loginResult) {
                      Constants.showProcessDialogCustomText(context, "Logging in...");
  
                      RequestFacebookData();
                  }
  
                  @Override
                  public void onCancel() {
                  }
  
                  @Override
                  public void onError(FacebookException exception) {
                      ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
                      ClipData clip = ClipData.newPlainText("error", exception.toString());
                      clipboard.setPrimaryClip(clip);
                      Toast.makeText(context, "Error while logging with Facebook", Toast.LENGTH_SHORT).show();
                  }
              });
  
  private void signInWithFacebook() {
      loginButton.setReadPermissions("email", "public_profile");
      loginButton.performClick();
  
  }
  </code></pre>
  
  <p>here is the code part.</p>
  
  <p>I have set my app as public from "<a href="https://developers.facebook.com/apps/appId/settings/basic/" rel="nofollow noreferrer">https://developers.facebook.com/apps/appId/settings/basic/</a>"</p>
  
  <p>Given Hash keys by generating with cmd also from the code</p>
  
  <pre><code>keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "C:\Users\SHAKI\Downloads\openssl-0.9.8k_WIN32\bin\openssl" sha1 -binary | "C:\Users\SHAKI\Downloads\openssl-0.9.8k_WIN32\bin\openssl" base64
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>try {
          PackageInfo info = getPackageManager().getPackageInfo(
                  "com.happihub.bd",
                  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 (PackageManager.NameNotFoundException e) {
  
      } catch (NoSuchAlgorithmException e) {
  
      }
  </code></pre>
  
  <p>Generated hash key with cmd for signed apk</p>
  
  <pre><code>keytool -exportcert -alias happihub -keystore E:\File\Android\FOZ_Files\relese.jks | "C:\Users\SHAKI\Downloads\openssl-0.9.8k_WIN32\bin\openssl" sha1 -binary | "C:\Users\SHAKI\Downloads\openssl-0.9.8k_WIN32\bin\openssl" base64
  </code></pre>
  
  <p>Note that, I can log in with my facebook account only(linked with the app). Other people get the error. most interestingly I tried with other account with my phone in debug mode, that account can also log in .. but when I use release apk my and other account doesn't get "SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: null", It directly shows a activity with hashkey not matched. See screenshot
  <a href="https://i.stack.imgur.com/bcb33.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bcb33.png" alt="Release apk with other account"></a></p>
  
  <hr>
  
  <h1>Solved</h1>
  
  <p>All I had to do is try to get hash key from a linux machine. :)</p>