Warning: Sessionless Request needs token but missing either application ID or client token

前端 未结 6 1963
南笙
南笙 2021-02-05 02:44

Using the FB SDK for Android sometimes it throws me error in Logcat.

Anyone knows the reason? My app is running and approved (Not on google play). I\'m also using the ha

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-05 03:16

    You should check your Hash Key in Settings at https://developers.facebook.com Try the code below to check and add correct hashkey. It work for me!!!

    private void getSHAFingerPrint(){
          PackageInfo info;
          try {
    
              info = getPackageManager().getPackageInfo(
                      "your.package", PackageManager.GET_SIGNATURES);
    
              for (Signature signature : info.signatures) {
                  MessageDigest md;
                  md = MessageDigest.getInstance("SHA");
                  md.update(signature.toByteArray());
                  String something = new String(Base64.encode(md.digest(), 0));
                  Log.e("Hash key", something);
                  System.out.println("Hash key" + something);
              }
    
          } catch (NameNotFoundException e1) {
              Log.e("name not found", e1.toString());
          } catch (NoSuchAlgorithmException e) {
              Log.e("no such an algorithm", e.toString());
          } catch (Exception e) {
              Log.e("exception", e.toString());
          }
      }
    

提交回复
热议问题