maxum
maxum

Reputation: 2915

Auth Dialogue loads in canvas first

When a user lands on my app and has not gone thru the authorise process the dialogue opens in the canvas first then reloads outside of the canvas. Apart from not looking quite right for a few seconds everything performs as expected.

I use header('Location:https://www.facebook.com/dialog/oauth/?client_id=12345678910&redirect_uri=https://apps.facebook.com/namespace/&state=&scope='); at the top of my app should it be detected that authentication has not been accepted.

enter image description here

Upvotes: 0

Views: 40

Answers (1)

Lix
Lix

Reputation: 47986

I always use a JavaScript redirect becuase a canvas application is already inside an iFrame and we want to redirect the top window to the authentication dialog.

Try this PHP function that echo's out a JavaScript redirect.

function jsRedirect($url){
    echo "<script language=javascript>";
    echo "top.location.href ='".$url."';";
    echo "</script>";
    exit();
}

Notice that we use top.location.href as opposed to window.location.href.

Upvotes: 1

Related Questions