Hesto/multi-auth

Auth::guard('admin')->user() return null after login

Opened this issue · 6 comments

Im trying to build multi auth but got an issue.
After login and redirect, I can't get logged user information. Also tried to get in middleware but can't.

I find out something: if I remove mapAdminRoutes function in RouteServiceProvider.php then write the route normally in the route file, it's working properly.
What's wrong there?

Did you solve it sir

@HoangDang2589 yes i solved it. Go to RouteServiceProvider.php, under map function should remove any line which be generated by command. Then you write route normally with middleware

Didn't solved my problem having same problem getting null values when using Auth::guard('admin')->user() after login

@nguyencnttk8c can u paste ur code here?, i got some issue
thanks

@pandikapinata
During working on module, i found something. If we use web middleware in route then it's work.
Below is my code to solve issue.

Route::group( ['module'=>'ProfileUser', 'namespace' => $namespace.'\Customer\Controllers', 'middleware' => ['web']], function() { Route::get('customer-profile', 'ProfileCustomerControllers@profile'); } );

I also noticed that in RouteServiceProvider.php dont have web middle in map function.

protected function mapCustomerRoutes() { Route::prefix('customer') ->middleware('customer') ->namespace($this->namespace) ->group(base_path('routes/customer.php')); }

Hope it useful!

any solution ? i have the same error , and nothing helps me