Laravel Passport Route [login] not defined

前端 未结 6 1209
傲寒
傲寒 2021-02-19 07:36

i use Laravel passport for auth

in route api.php

Route::get(\'/todos\', function(){
  return \'hello\';
})->middleware(\'auth:api\');
6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 07:38

    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.

    see below image to see where to set the accept parameter:

提交回复
热议问题