Route [login] not defined.Route [login] not defined.
Use Postman and set the Header `Accept: application/json` otherwise Laravel
Passport would never know it's an API client and thus redirect to a /login
page for the web.
Route [login] not defined.Route [login] not defined.
Use Postman and set the Header `Accept: application/json` otherwise Laravel
Passport would never know it's an API client and thus redirect to a /login
page for the web.
Route [login] not defined.Route [login] not defined.
You're trying to redirect to a named route whose name is login, but you have
no routes with that name:
Route::post('login', [ 'as' => 'login', 'uses' => 'LoginController@do']);
The 'as' portion of the second parameter defines the name of the route. The
first string parameter defines its route.
Route [login] not defined.Route [login] not defined.
To check either request includes token or not make your own middleware.
php artisan make:middleware CheckApiToken
public function handle($request, Closure $next)
{
if(!empty(trim($request->input('api_token')))){
$is_exists = User::where('id' , Auth::guard('api')->id())->exists();
if($is_exists){
return $next($request);
}
}
return response()->json('Invalid Token', 401);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us