laravel 4 hybridauth on multiple routes -
i'm trying switch codeigniter laravel.
i have implemented hybridouth method successful, seems working route it's specified on.
i've tried searching tutorials , examples show auth working on 1 route.
how can give function along every route check if user logged in?
group auth needed.
route::group(array('before' => 'auth'), function() { // routes auth needed });
this seems call normal auth , i'm using hybridauth
route::get('social/{action?}', array("as" => "hybridauth", function($action = "") { if ($action == "auth") { try { hybrid_endpoint::process(); } catch (exception $e) { return redirect::route('hybridauth'); } return; } try { $socialauth = new hybrid_auth(app_path() . '/config/hybridauth.php'); $provider = $socialauth->authenticate("facebook"); $userprofile = $provider->getuserprofile(); } catch(exception $e) { return $e->getmessage(); } echo "<pre>" . print_r( $userprofile, true ) . "</pre><br />"; }));
if going run request @ every route, use filter
app::before(function($request) { //check if user logged in here });
or create filter , group routes
route::group(array('before' => 'auth'), function() { });
Comments
Post a Comment