php - Combining HybridAuth with Javascript SDKs? -
(repost https://groups.google.com/forum/?hl=en&fromgroups=#!topic/hybridauth/cwo2r9suyts)
starting facebook, i'm trying use provider javascript sdks login , have hybridauth "know" it. appreciated.
i started including configuration ids in data pass view can use them when calling javascript login functions. in middle of getproviders function of hybrid_auth class, added:
if(array_key_exists('keys', $params) && array_key_exists('id', $params['keys'])) $idps[$idpid]['id'] = $params['keys']['id'];
my javascript includes this:
fb.init({ appid:'<?php echo $providers['facebook']['id']; ?>', cookie:true, status : true, xfbml:true });
so far good.
but after logging in (i.e., fb.login()) of course hybridauth doesn't know , doesn't have user information.
then "force" it, tried calling ".../hauth/login/facebook" method via ajax:
$.ajax({ type: "post", url: ".../hauth/login/facebook", cache: false, ...
unfortunately, seems number of 'redirects' in hybridauth make not work. added "data: {ajax:true}," ajax call , tried modify hyrbidauth not redirect if $_post['ajax'] existed. didn't seem either. (i removed "die();" @ end of redirect() function no avail.)
i'm thinking i'm either on right track or need add new hybridauth method detect , store data or specific connections exist.
any ideas?
thanks.
i attempted several ways login provider using javascript sdk , integrate hyrbidauth. no solution pretty, , each required alter hybridauth difficult maintain. determined best solution follow "widget" example included hybridauth.
i didn't use widget, code shows method opening , closing separate smaller window using javascript. window's url contains information server call hybridauth's 'authenticate' method redirects provider's login/approval page.
the effect same: user stays on same page while authenticating provider in separate "window."
Comments
Post a Comment