Priska Aprilia
Priska Aprilia

Reputation: 1149

Cartalyst Sentinel check() always returns false in Laravel 5.2

I use Cartalyst Sentinel to authenticate user

$status=Sentinel::authenticate($credentials);

the above code is in the login function in UserController. In the login function I can see that the Sentinel::check() returns some data. However, after login and redirecting the another page in the AccountController, the Sentinel::check() always returns false despite the user has logged in and not yet trigged the logout button.

Anyone knows how to solve this problem ?

Upvotes: 3

Views: 607

Answers (1)

atxpunkrock
atxpunkrock

Reputation: 514

You'll need to verify that you are setting the user to remember.

Sentinel::authenticateAndRemember($credentials)

Just authenticating doesn't set the user in the session. If that doesn't fix your problem you should verify the Facade you're using. Sentinel comes packaged with two facades, both a Laravel and Native facade. If you're using Laravel and call the Native Facade you will get a false return. The inverse does the same.

Hope that helps.

Upvotes: 1

Related Questions