Questions tagged [laravel-guard]
24 questions
13
votes
6 answers
How to enable both api and web guard in laravel
Laravel 5.7
PHP 7.2.10
Currently I am able to use any one of web and api guards, is there any way to allow both, so that both web app and api will work together.
Something like
return [
/*
…

Prafulla Kumar Sahu
- 9,321
- 11
- 68
- 105
4
votes
2 answers
laravel breeze Multi Auth - Admin Guard with two diffirent registration
I'm using laravel breeze as auth scaffolding package.I want to create Multiple Authentication using laravel guards for two different registration form for two User Types (Admin, User).
The Main Idea of what I want to achieve :
I have two tables in…

Haron
- 2,371
- 20
- 27
4
votes
1 answer
Class App\Http\Middleware\Authenticate:api does not exist on Broadcasting
I am having an issue with the auth:api guard working with broadcasting.
I get the error Class App\Http\Middleware\Authenticate:api does not exist if I call php artisan route:list.
BroadcastServiceProvider.php:

Jacob Hyde
- 980
- 1
- 12
- 20
3
votes
0 answers
How to use Multiple Passport Personal Access Clients for different Auth Guards
Passport 10:0
Laravel 9.0
php 8.1
Description
Thankyou in advance. My application has four user types and uses multiple guards for each, i.e, admins, agents, companies, and normal users. All of these guards use API authentication via personal access…

AmG
- 31
- 1
1
vote
1 answer
Laravel Multiple Guard Authentication Failure
I am creating a Laravel Website with multiple guards. My Goal is to be able to login as Admin, Employee and User using session and User-API using passport. Everything worked fine. However, I wasn't able to Login as Employee.
Here is the git repo.…

Hilal Najem
- 147
- 4
- 15
1
vote
1 answer
Create a simple guard in laravel
I am trying to implement a very simple authentication mechanism with Laravel.
I need to protect certain routes so they are viewable from a specific IP address.
I want to do this:
if ($_SERVER['REMOTE_ADDR'] != '123.45.67.89') {
return…

idan
- 43
- 6
0
votes
0 answers
Laravel multiple user DB tables, models and guards - user resources not showing in the Nova admin panel
I have separated basic users from admins - basic users are in the "clients" table and admins in the "users" table. I'm using Laravel Nova 4 as an admin panel.
My auth.php config looks like this:
return [
'defaults' => [
'guard' =>…

Paulis
- 13
- 2
0
votes
0 answers
broadcasting auth on custom guard using Laravel passport is returning 401 Unauthorized
Getting 401 Unauthorized on broadcasting/auth for presence channel
Note: Same middleware I'm using on other end-point with same token and giving me response
here is channel.php code
Broadcast::channel('broadcast-restaurant-message.{id}', function…

Tehseen
- 1
- 3
0
votes
1 answer
guards laravel authenticated in a single table
I have a users table in which general data about users is stored and there is an admins table in which there is a key to the users table and what special data, how do I properly configure and implement guards so that for both guards the input occurs…

Sergei Semenets
- 35
- 6
0
votes
0 answers
Custom laravel authentication: What's next after authenticating users via Fortify::authenticateUsing()
The goal of my task is to properly authenticate username and password against a third party API, get the access token and store in the session, and use the access token to get user details such as email, full name, etc, and store them in the…

bonbon.langes
- 1,718
- 2
- 22
- 37
0
votes
0 answers
using laravel guard in laravel breeze and multi authentication
I'm using laravel 8 and laravel breeze for authentication and now want to use guard for authenticating different users like "admin users" and others using different tables (users, admins, so on) or even in a same table and model.
how can I do…

reza
- 11
- 4
0
votes
0 answers
How to pass college ID of a admin based on his login details in Laravel
There's a college alumni portal, where the admin logins and he has to get in details of his colleges only based on the college ID (college ID will be specified by admin during registration and by students when they add their regno's).
How to pass…

Preethi Shetty
- 60
- 8
0
votes
0 answers
Laravel 9: User not authenticated on API routes using custom guard
I need to authenticate temporary users of a third party app. In addition, users only get a signed URL to login (there is no username/password). The temporary users get created on the fly and logged in after verifying the signed URL and some query…

NKnuelle
- 234
- 2
- 19
0
votes
0 answers
Login in Laravel/lumen with two different Models for same routes use guards
I am trying to authorize users in Lumen from different tables using guards. What am I doing wrong? Please correct me.
I got False in login() (AuthController.php).
config/auth.php
'defaults' => [
'guard' => 'api',
'passwords' =>…

Vyacheslav
- 59
- 5
0
votes
1 answer
Laravel custom middleware returning guard as false
I am making a custom authentication in laravel 9 with custom middleware and custom guard, But the guard in my custom middleware returns false, This is my code

Waleed
- 73
- 1
- 9