If you get invalid credential error when hosting your application on Heroku check your application setting:
Step 1:
Canvas Type:
Make sure IFrame is selected.
Step 2:
Open
FBUtils.php
and go to line 94, it reads
echo("<script> top.location.href='" . $authorize_url . "'</script>");
replace it by
echo("<script> window.location.href='" . $authorize_url . "'</script>");
and that’s all, you won’t get off of FB and your app will be inside the iframe!