Category : authentication

I’m trying to make the Laravel’s auth middleware work but I’m getting an error and I have no idea how to solve it. Illegal offset type vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php:68 AuthManager.php public function guard($name = null) { $name = $name ?: $this->getDefaultDriver(); return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name); // <– This is where the error is } app/Http/Kernel.php ..

Read more

I have the following set-up: Laravel running with Homestead Domain laravel-api.test pointing to my Homestead environment React (npx create-react-app) running locally with a custom HOST app.laravel-api.test:3000 Laravel In my routes (routes/api.php) I added two routes: Route::post(‘login’, [AppHttpControllersLoginController::class, ‘login’]); Route::middleware(‘auth:sanctum’)->get(‘books’, [AppHttpControllersBookController::class, ‘list’]); In my config/cors.php I added: ‘paths’ => [‘api/*’, ‘sanctum/csrf-cookie’], ‘allowed_methods’ => [‘*’], ‘allowed_origins’ => ..

Read more

I’am working on a larger web app using laravel (v8) because of the expected size to which the project probably will grow I decided to split the frontend and backend into two different repos from the beginning. Now I want to implement user authentication for the frontend my problem now is how should I approach ..

Read more

The default Breeze authentication installation uses the RegisteredUserController to register a new user, which works perfectly. Route::post(‘/register’, [RegisteredUserController::class, ‘store’]) ->middleware(‘guest’); In the next step, the ‘verification.verify’ route throws a unauthenticated exception, as the user still needs to be verified. Route::get(‘/verify-email/{id}/{hash}’, [VerifyEmailController::class, ‘__invoke’]) ->middleware([‘auth’, ‘signed’, ‘throttle:6,1’]) ->name(‘verification.verify’); My RegisteredUserController does do a Auth::login but this does ..

Read more

The default Breeze authentication installation uses the RegisteredUserController to register a new user, which works perfectly. Route::post(‘/register’, [RegisteredUserController::class, ‘store’]) ->middleware(‘guest’); In the next step, the ‘verification.verify’ route throws a unauthenticated exception, as the user still needs to be verified. Route::get(‘/verify-email/{id}/{hash}’, [VerifyEmailController::class, ‘__invoke’]) ->middleware([‘auth’, ‘signed’, ‘throttle:6,1’]) ->name(‘verification.verify’); My RegisteredUserController does do a Auth::login but this does ..

Read more

Error This is the error I have been receiving while using Postman BadMethodCallException: Method IlluminateAuthRequestGuard::attempt does not exist. in file C:xampphtdocsproject-appvendorlaravelframeworksrcIlluminateMacroableTraitsMacroable.php on line 103 I have two tables users and employees and my login API is only working for users table but not for employees table. This is my EmployeeController public function employeeLogin(){ if(Auth::guard(’employee-api’)->attempt([’email’ => ..

Read more

Hello guys im trying to customize the Register of Laravel and i have this working but i need to add in some fields the last ID registered… in my actual code it register all ok.. but no login automatic afte register. class RegisterController extends Controller { /* |————————————————————————– | Register Controller |————————————————————————– | | This ..

Read more

I am developing a web page. I have included the Auth library in my project. However, I also have to login for the contact and about us pages. How can I fix this? My web.php : Route::get(‘/’, function () {return view(‘index’); }); Route::get("/abaout", [HomeController::class, "indexAbaout"])->name("abaout"); Route::get("/services", [HomeController::class, "indexServices"])->name("services"); Route::get("/projects", [HomeController::class, "indexProjects"])->name("projects"); Route::get("/products", [HomeController::class, "indexProducts"])->name("products"); Route::get("/contact", ..

Read more

I’m working on creating APIs for the first time using laravel, please excuse me if I mention anything incorrect and let me know how to correct it. I have followed this article to create API authentication, https://www.toptal.com/laravel/restful-laravel-api-tutorial now I’m able to register the user and I’m getting api-token as per the blog, but when I ..

Read more