I have added the passport based API authentication in my laravel API and trying to request from Angular webapp but there is a error saying that
"NotFoundHttpException in RouteCollection.php line 161:"
calling to this route
/user/api
My route.php
<?php
header('Access-Control-Allow-Origin: *');
header( 'Access-Control-Allow-Headers: Authorization, Content-Type,Authentication,Device,UID' );
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::group(['middleware' => 'auth:api'], function(){
Route::get('/', function () {
return view('welcome');
});
});
api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:api');
/api/user
? Check the output ofartisan route:list
– nCrazed