Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Created dedicated example here: <a href="http://demo.ambienttech.lv/d.html?ns=d3" rel="nofollow">http://demo.ambienttech.lv/d.html?ns=d3</a></p> <p>Example is downloadable and includes instructions of setting up facebook app as well. See if that helps.</p> <hr> <p>Try This:</p> <pre><code>&lt;?php class page_fb extends Page { function init(){ parent::init(); $f = $this-&gt;add("oauth/Controller_OAuth_Facebook"); $fbtoken = $this-&gt;api-&gt;recall("fbtoken"); if ($m = $_GET["error_msg"]){ $v=$this-&gt;add("View_Error"); $v-&gt;add("Text")-&gt;setHTML("You can't connect to the application."); $v-&gt;add("Button")-&gt;setHTML("Try again")-&gt;js("click", $this-&gt;js()-&gt;univ()-&gt;location("fb")); return; } if (!$fbtoken){ if ($fbtoken = $f-&gt;check("email")){ $this-&gt;api-&gt;memorize("fbtoken", $fbtoken); $this-&gt;api-&gt;redirect($this-&gt;api-&gt;url("/index")); } } else { $f-&gt;setSignatureInfo(); $f-&gt;setAuthToken($fbtoken["access_token"], $fbtoken["expires"]); $c = $this-&gt;add("sni/Controller_SNI_Facebook"); $c-&gt;setOAuth($f); if (!$this-&gt;api-&gt;recall("fbuserinfo")){ $this-&gt;api-&gt;memorize("fbuserinfo", $c-&gt;getUserProfile()); } $info = $this-&gt;api-&gt;recall("fbuserinfo"); $username = $info-&gt;username; $img = $c-&gt;customRequest("/" . $username . "/picture?type=large"); $this-&gt;api-&gt;memorize("userimg", $img); $this-&gt;api-&gt;memorize("userinfo", $info); if (!$this-&gt;api-&gt;auth-&gt;isLoggedIn()){ $this-&gt;api-&gt;auth-&gt;login($info-&gt;email); } $this-&gt;api-&gt;redirect($this-&gt;api-&gt;url("/index")); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload