laravel护照api身份验证 [英] laravel passport api authentication
本文介绍了laravel护照api身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Laravel中的api authentication
(护照)的新手.
是否可以使用
I'm new to api authentication
(passport) in laravel.
Is it possible to guard api routes using
$this->middleware('auth:api');
即使使用了内置的laravel身份验证
(php artisan make:auth)
?
even if used the laravel built in authentication
(php artisan make:auth)
?
推荐答案
您可以使用auth:api
保护您的api,只需将config/auth.php
you can guard your api with auth:api
, just need to change the api guard driver to passport in config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
//'driver' => 'token',
'driver' => 'passport',
'provider' => 'users',
],
],
这篇关于laravel护照api身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文