这与api login一起运行良好。当我更新作曲家时,它不起作用并显示错误消息。 InvalidArgumentException 未定义防护[pubApi]的身份验证驱动程序[jwt]。
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
'publisher' => [
'driver' => 'session',
'provider' => 'publishers',
],
'advertiser' => [
'driver' => 'session',
'provider' => 'advertisers',
],
'pubApi' => [
'driver' => 'jwt',
'provider' => 'publishers',
],
'advApi' => [
'driver' => 'jwt',
'provider' => 'advertisers',
],
],
登录功能
public function login(Request $request){
$credentials = request(['email', 'password']);
$type = $request->type;
if ( ! $token = auth('pubApi')->attempt($credentials)) {
return $this->respondWithError('Unauthorized');
}else
$user = Publisher::where('email',$request->email)->update(['api_token'=>$token]);
$user = $this->me('pubApi');
return $this->respondLogin($token,$type,$user);
}