AgileToolkit OAuth add-on error 500 at facebook's mobile site -
i using oauth facebook controller add-on atk4.
- it works expected when authenticating facebook regular desktop browser.
- it works when authenticating using mobile browser telling face book it's desktop browser.
- it not work when facebook detects mobile browser , redirects m.facebook.com/dialog/oath.
what's more, works fine signups mobile browsers (ie, when facebook asks user give permission app).
the login flow stops error 500 at: https://m.facebook.com/dialog/oauth?redirect_uri={my_url_encoded_landing_page_where_the_oauth_controller_lives}&scope=email&client_id={fb_app_id}
what hell going on here? there isn't difference between facebook mobile service , regular 1 addon isn't taking care of, or there?
it must i'm doing wrong. in init() on page handles fb, doing following:
function init(){ parent::init(); $f = $this->add("oauth/controller_oauth_facebook", array('sign_method'=>'plaintext')); if ($fbtoken = $f->check()) { $f->setsignatureinfo(); $f->setauthtoken($fbtoken["access_token"], $fbtoken["expires"]); $s = $this->add("sni/controller_sni_facebook"); $s->setoauth($f); // ... // grab profile sni, database lookup, session stuff, etc // ... } }
i've tried 3 sign_methods, , tried leaving alone, doesn't make difference because user not making controller access token use anyway.
i tried creating new app facebook , same issues vanilla configuration on that. i've marked , specified "website facebook login" site url integration.
the image below captured chrome after overriding user agent mobile device trigger forward facebook's mobile servers: screen shot of request
facebook closed bug report them stating it's not issue since no 1 else reporting bug. removing atk4 tag, same issue using example php code provided facebook on git.
created dedicated example here: http://demo.ambienttech.lv/d.html?ns=d3
example downloadable , includes instructions of setting facebook app well. see if helps.
try this:
<?php class page_fb extends page { function init(){ parent::init(); $f = $this->add("oauth/controller_oauth_facebook"); $fbtoken = $this->api->recall("fbtoken"); if ($m = $_get["error_msg"]){ $v=$this->add("view_error"); $v->add("text")->sethtml("you can't connect application."); $v->add("button")->sethtml("try again")->js("click", $this->js()->univ()->location("fb")); return; } if (!$fbtoken){ if ($fbtoken = $f->check("email")){ $this->api->memorize("fbtoken", $fbtoken); $this->api->redirect($this->api->url("/index")); } } else { $f->setsignatureinfo(); $f->setauthtoken($fbtoken["access_token"], $fbtoken["expires"]); $c = $this->add("sni/controller_sni_facebook"); $c->setoauth($f); if (!$this->api->recall("fbuserinfo")){ $this->api->memorize("fbuserinfo", $c->getuserprofile()); } $info = $this->api->recall("fbuserinfo"); $username = $info->username; $img = $c->customrequest("/" . $username . "/picture?type=large"); $this->api->memorize("userimg", $img); $this->api->memorize("userinfo", $info); if (!$this->api->auth->isloggedin()){ $this->api->auth->login($info->email); } $this->api->redirect($this->api->url("/index")); } } }
Comments
Post a Comment