I installed the Laravel Passport package for Laravel 5.3 as described in the official documentation ( https://laravel.com/docs/5.3/passport#introduction ).
I want the API to be used by the mobile application, so I'm trying to implement password tokens . I created a client to provide a password and a token request process ...
$response = $http->post('http://my-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'username' => 'my@email.com',
'password' => 'my-password',
'scope' => '',
],
]);
... just works as expected, returning an access token and a refresh-token for one of my users.
One side,
php artisan route:list
Enumerates the correct middleware for api / user URI: api, auth: api
api guard config/auth.php.
, (https://laravel.com/docs/5.3/passport#installation).
api.php:
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:api');
, http://my-app.com/api/user, , 'web', "api"...
, /login ( ), /home, ...
.
.