passport-multiauth
passport-multiauth copied to clipboard
Unauthenticated
login with custom provider is successfull, but always Unauthenticated when user Route::group(['middleware' => 'multiauth:member'], function(){
Route::get('/member', function($request){
$request->user();
});
})`
this my auth.php

this my model

this my Kernel

and this my route api

can you help me for solution this issue? and sorry for my english
I'm encountering the same issue
Please, let me know your laravel, passport and passport-multiauth versions.
- Updating laravel/framework (v5.8.0 => v5.8.27): Downloading (100%)
- Updating laravel/passport (v7.2.0 => v7.3.1): Downloading (100%)
- Updating smartins/passport-multiauth (v4.0.0 => v4.1.0): Downloading (100%)
In the version 4.0.0 of the package all works fine?
Unfortunately not, the issue appeared before and after the update.
I just noticed that locally it's working fine, but seems that the issue related to the hosting?
same me, i have error, i'm using laravel 5.7 and version 4.0.0.
The same for me... Laravel 5.8.33 + Passport 7.4.0 + Passport Multi-Auth 4.1.0
@sfelix-martins : please help me
Hi
Please check if the default guard is web on config\auth.php
Hi,
I also having the same issue. I already follow everything even tried to Install everything from the very beginning. Can you suggest a solution on this? I try to change the Routing to this
Route::group(['middleware'=>['auth:externals']],function() { Route::post('/bl/transaction', 'Api\Marketplace\WarungBukalapakController@acceptTransaction'); Route::get('/bl/transaction/{bl_transaction_id}', 'Api\Marketplace\WarungBukalapakController@checkTransaction'); });
Now it with the token provided it can access it. But if I use another token with different provider it still let through. Please need help.
Hi I was have the same problem but I solved it by check the provider in login function If the provider = customer I login with model Customer and generate access-token from Customer model if the provider = admin I deal with Admin Model and so on . and I check if customer access-token can access admin route nothing happens customer access-token can only access customer routes
public function login()
{
if (request('provider')==='vistor') {
if (Customer::where('email', request('email'))->count()>0) {
Customer::where('email', request('email'))->first()->password;
if (Hash::check(request('password'), Customer::where('email', request('email'))->first()->password)) {
$user = Customer::where('email', request('email'))->first();
$success['token'] = $user->createToken('MyApp')-> accessToken;
return response()->json(['success' => $success], $this-> successStatus);
} else {
return response()->json(['error'=>'Unauthorised'], 401);
}
} else {
return response()->json(['error'=>'Unauthorised'], 401);
}
} elseif (Admin::where('email', request('email'))->count()>0) {
Admin::where('email', request('email'))->first()->password;
if (Hash::check(request('password'), Admin::where('email', request('email'))->first()->password)) {
$user = Admin::where('email', request('email'))->first();
$success['token'] = $user->createToken('MyApp')-> accessToken;
return response()->json(['success' => $success], $this-> successStatus);
} else {
return response()->json(['error'=>'Unauthorised'], 401);
}
} else {
return response()->json(['error'=>'Unauthorised'], 401);
}
}
My Route
Route::group(['middleware' => 'auth:customer'], function(){
Route::post('getaction', 'API\AuthApiController@action');
});
Route::group(['middleware' => 'auth:admin'], function(){
Route::post('getitem', 'API\AuthApiController@items');
});
I have the same problem, this issue has answer?