'Laravel 8 API guard multi provider
I'm trying to make an API using Laravel 8. I have two user tables, third_party_users and customer_users
domain.tld/api/v1 --> for open API (third-party)
domain.tld/api/frontend --> for frontend app (customer)
but in config/auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'customers',
],
'api' => [
'driver' => 'passport',
'provider' => ??????????, // what I must to do?
],
],
'providers' => [
'customers' => [
'driver' => 'eloquent',
'model' => App\Models\Customer::class,
],
'thirdparty' => [
'driver' => 'eloquent',
'model' => App\Models\ThirdParty::class,
],
],
and in app/Providers/RouteServiceProvider.php
Route::middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
what I must write parameter provider in api guard on config/auth.php?
and how to make sure when request to api/v1 using thirdparty provider and api/frontend using customer provider?
please help me. thanks before.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
