Not using any kind of session.Using user token authentication.Its working as follows.
2.Mobile User will send the user id and the user token along with every Server API call.
3.Server API will verify the user id & token with the values saved in the Database .If it matches it will continue with other functionalities.Else it will return invalid authentication.
In this scenario is it possible to use Auth::user()?
in that scenario, nope.
You can do something like this:
class ApiBaseController
{
public $user;
public function __construct()
{
$this->user = $this->authenticateUser();
}
private function authenticateUser()
{
// return authenticated user
// if authentication failed abort(403)
}
}
class DoSomethingApiController extends ApiBaseController
{
public function listThings()
{
return Things::getThingsByUser($this->user);
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community