For two days I am digging google but could not find the starting thread for my problem, now I am out of option. Please help me with some direction/howTo
I have a web application running built with laravel 5.3, I have installed passport as described here . if I go /home
its showing perfectly.
Now I have to make an android app from which
- An already existing user of web app can login
- get all the task list of that user
TaskModel (ons_tasks(id, title, description))
routes related only
in web.php
Auth::routes();
in api.php
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:api');
Route::group(['middleware' => ['auth:api']], function () {
Route::get('/test', function (Request $request) {
return response()->json(['name' => 'test']);
});
Route::get('/task/list', function (Request $request) {
$list = \App\Model\TaskModel::all();
return response()->json($list);
});
});
To login : if I send post request
/login
with email & password get theTokenMismatchException
error but Where do I obtain a token for android app in mobile? Do I need theAuth::routes()
in the api too? if then what else Do I need to just login and get a token so later I can send it for geting the task lists.
Secondly,
If I go to
/api/test
it redirects me to/home
page without showning any error !!!
Thanks in advance.
via Atiqur