These days there are better solutions for user authentication, which solve the headaches JSON Web Token Tutorial: An Example in Laravel and AngularJS..