artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
684 stars 217 forks source link

How to check if a user is logged in? #89

Closed dant89 closed 4 years ago

dant89 commented 10 years ago

I'm trying to check whether a user is logged in via Facebook, this works but if they're not logged in then an exception is thrown:

if($fb->getStorage()->retrieveAccessToken('Facebook')->getAccessToken()){

Something like this?

if($fb->getStorage()->hasAccessToken('Facebook')){
ConstantinStan commented 9 years ago

You should get Facebook data, save it in the database and then login the user according to that data that you have stored