php - Facebook App Error forbidden by X-Frame-Options -
I am currently creating a Facebook app in sandbox mode. My code: -
Index.php
& lt ;? Php ob_start (); @session_start (); 'Facebook.php' is required; Include_once ('config.php'); $ Facebook = New Facebook (array ('appId' => APP_ID, 'secret' => SECRET_KEY,)); $ User = $ facebook-> GetUser (); If ($ user) {try {// go ahead, to know that you have logged in user who is certified $ user_profile = $ facebook- & gt; API ('/ m'); } Hold (FacebookApiException $ e) {error_log ($ e); $ User = null; } If (! Empty ($ user_profile)) {# User information is correct? Let's print it out (here we will add login and registration routines) $ username = $ user_profile ['name']; // resonance '- & gt;' $ Username; Exit; $ Uid = $ user_profile ['id']; $ Email = $ user_profile ['email']; @session_start (); // $ _ session ['id'] = $ userdata ['id']; $ _SESSION ['oauth_id'] = $ UID; $ _SESSION ['username'] = $ username; $ _SESSION ['email'] = $ email; $ _SESSION ['oauth_provider'] = 'Facebook'; Header ("location: home.php"); ? & Gt; & Lt ;? Php} else {# For testing purposes, if the error has occurred, then let the script die ("There was an error."); }} And {# there is no active session, let's have a $ login_url = $ facebook-> GetLoginUrl (array ('scope' = & gt; 'email')); Header ("Location:" $ login_url); }? & Gt; Here I am checking if the user is logged in or not, if he is a logged user then again to login to the page on Facebook, then submit the PHP again. But when I launch my app on Facebook, it throws an error on the console: -
The document refused to display because it was observed by the X-frames-option Display because this' x-frames-option 'to' denny ''
>
Do you have any kind of fry Within Display login dialog? ??? This is an anti-phishing remedy, the user should always be able to verify that the entrance dialogs shown are actually from facebook.com, and there is no duplicate filled with any other site.
You have to redirect it to the top window instance. It can not be server-side, so you have to use Javascript:
& lt; Script & gt; Top.location.href = "single ???? |"; & Lt; / Script & gt;
Comments
Post a Comment