Facebook Registration API in Java

Example from [facebok developer's doc][1] is in PHP. signed_request contents:

'; $response = parse_signed_request($_REQUEST['signed_request'], FACEBOOK_SECRET); echo '
	echo '
'; } else { echo '$_REQUEST is empty'; } ?> I started to do it in java. But im stuck in checking the `signature`.: String data[] = signed_request.split("\\."); Base64 decoder = new Base64(true); byte[] decodedBytes = decoder.decode( data[1] ); String result = new String(decodedBytes); byte[] dc = decoder.decode(data[0]); String signature = new String (dc); System.out.println("signature: " + signature); JdomParser parser = new JdomParser(); JsonRootNode rootNode; try { rootNode = parser.parse(result); String algorithm = rootNode.getStringValue("algorithm"); if ( ! algorithm.equals("HMAC-SHA256")){ return INPUT; } String FBSECRET = "my_app_secret"; //what would be next? } catch (InvalidSyntaxException e) { e.printStackTrace(); } What function is equivalent of `hash_hmac` in java? `result` is now in `JSON` format. But the value of `signature` when printed will display weird characters like `���y�'��D`]���D�|~���7�`. Thanks. [1]: https://developers.facebook.com/docs/plugins/registration/
stackoverflow.com/questions/1609899/…, stackoverflow.com/questions/6312544/…, google.com/search?q=hash_hmac+in+java

以上就是Facebook Registration API in Java的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准