say I have a user that need to authenticate to my laravel 5.2 api !
the user do not have an api_token yet, so he is gonna give email and password to get back his api_token and store it (I may be wrong)! the question is how can I authenticate this users for the first time? is there a way in laravel 5.2 to do that ? something like Auth::guard('api')->attempt($array) ?
Add a comment
|
1 Answer
You can manually authanticate users by
Auth::login($user);
Your user should be a real user in users table in database.
So in your situation, you can get email address and username via form, insert it to database and login that user with the code above.
I hope it helps
1 Comment
Siempay
that code above will login the $user using the web guard not the api guard