title: oauth facebook within page tab
body: <p>I have followed the facebook developer tutorial in order to do this to no avail.</p>
  
  <p>Basically I need user to authorize my app from within a page tab. </p>
  
  <p>I have used their recommended javascript to redirect the user on page load to redirect them to the oauth popup however when the app loads I just get the dreaded "sorry an error occurred"</p>
  
  <p>The URL that is generated is "https://www.facebook.com/dialog/oauth/?client_id=247274355370447&amp;redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fpages%2Fnull%2F286793781401206%2F247274355370447&amp;scope=email,user_about_me" so I can see my variables for both page_id and app_id are being passed in.</p>
  
  <p>Here is my complete JS code</p>
  
  <pre><code>&lt;script&gt;
  var oauth_url = 'https://www.facebook.com/dialog/oauth/';
  oauth_url += '?client_id=&lt;? echo $app_id;?&gt;';
  oauth_url += '&amp;redirect_uri=' +     encodeURIComponent('https://www.facebook.com/pages/null/&lt;?php echo $page_id;?&gt;/&lt;?php echo $app_id;?&gt;');
  oauth_url += '&amp;scope=email,user_about_me'
  window.top.location = oauth_url;
  &lt;/script&gt;
  </code></pre>