This is my first time implementing laravel passport
This is my config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
and this is where my routes/api.php
that are guarded by auth:api
Route::group(['middleware' => ['auth:api']], function () {
Route::resource('users','Users\AdminUsersController')->except([
'create', 'edit'
]);
});
and this is how I fetch the api
fetchUsers: async function(page_url){
await axios.get('api/users')
.then( response => {
vm.users = response.data.data;
})
.catch( error => {
console.log(error);
});
},
Im getting status 401 error unauthenticated. How can I fix this? TIA