public static String encodeAppSecretProof ( String appSecret , String accessToken ) { try { byte [ ] key = appSecret . getBytes ( StandardCharsets . UTF_8 ) ; SecretKeySpec signingKey = new SecretKeySpec ( key , "HmacSHA256" ) ; Mac mac = Mac . getInstance ( "HmacSHA256" ) ; mac . init ( signingKey ) ; byte [ ] raw = mac . doFinal ( accessToken . getBytes ( ) ) ; byte [ ] hex = encodeHex ( raw ) ; return new String ( hex , StandardCharsets . UTF_8 ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Creation of appsecret_proof has failed" , e ) ; } }
Generates an appsecret_proof for facebook .