Questions tagged [laravel-authentication]

Laravel ships with several pre-built authentication controllers for user registration, authentication, and password reset.

Laravel ships with several pre-built authentication controllers for user registration, authentication, and password reset.

376 questions
2
votes
1 answer

Using Sanctum with Laravel Spark conflict

My setup Laravel 8 Laravel Spark Mollie I'm constantly hitting a brick wall when calling API requests with Spark & Sanctum. I've installed Sanctum with no problem and migrated. I've added use Laravel\Sanctum\HasApiTokens; to app/Models/User.php…
2
votes
2 answers

How to change api_token parameter to some custom parameter like api_key or key

I have a Laravel application using API token authentication. By default, the user needs to pass the api_token parameter as part of the URL, but I want to change api_token to a custom name parameter like api_key. Currently the full URL looks…
2
votes
0 answers

Laravel Breeze Multi Auth Two register forms with different routes

I'm using laravel breeze as auth scaffolding package I want to create this stuff : The auth countrollers : app\Http\Controllers\Auth\Buyer If the Visitor choose to Create an account "Sign Up" as "Buyer" it will redirect him/her to specified…
jhon-jhones
  • 455
  • 1
  • 13
  • 27
2
votes
2 answers

Laravel Policy Always returns 403 unauthorized

I'm making an app that uses jwt as authentication system , when I try to update my Category model the policy always returns 403 unauthorized, I'm using apiResource to crud my model. my code in api.php: Route::apiResource('category',…
2
votes
0 answers

Ajax error 401 after successful login Laravel 8

I have a Laravel 8 project based on auth bootstrap scaffolding. It uses a custom UserProvider that authenticates a user from another source (AWS user pool). The login process works just fine. However, subsequent Ajax calls to a route fail with error…
user2233677
  • 199
  • 1
  • 8
2
votes
2 answers

Laravel | Updating the Logged-In User - save() vs update()

I want to update a field of the logged-in user. In my controller, this works: Auth::user()->the_field = $theField; Auth::user()->save(); This doesn't: Auth::user()->update(['the_field' => $theField]); I would expect this to work since similar code…
padawanTony
  • 1,348
  • 2
  • 22
  • 41
2
votes
0 answers

Laravel 7 Password Reset error: We can't find a user with that email address

Working on Laravel 7 Project. Required to reset password for multiuser (Admin,supervisor,student). Posting my code below. Password reset email link is working fine, but when i try to change my password it gives me error with email. I tried finding…
2
votes
2 answers

laravel 8 auth Route [login] not defined

'Route [login] not defined ..' I'm new to Laravel. I want to make a login system myself, but I still have not solved this error. I am logging in but the user appears blank on the other page, I still cannot control it. I want to use the user…
user14324351
2
votes
2 answers

login with email or phone in laravel 6 is not working

I want to login with either email or phone number in laravel auth. I write these codes but it returns me email field is required in User.php protected $fillable = ['name', 'email', 'password', 'phone']; in login Controller public function…
tariqul anik
  • 314
  • 6
  • 24
2
votes
2 answers

Assigning one route to multiple user without a package in laravel

I have created four user type admin,vendor,employee,customer. In the user migration file I have the following: public function up() { Schema::create('users', function (Blueprint $table) { $table->bigIncrements('id'); …
2
votes
4 answers

Custom 404 laravel

If we just create a 404.blade.php page in resources/views/error it will work fine, but Auth() won't work on 404 page, to solve that if we follow the solution available on stackoverflow the Laravel auth errors will stop working. I use the following…
2
votes
1 answer

Create customer on laravel registration

All I want to do is to create a stripe customer account for every registered user on Laravel. The problem I'm facing right now is that $new variable isn't passing to User::create function. I'm trying to edit RegisterController.php, here is create()…
2
votes
0 answers

Laravel 6 - Auth::user() returns null

I was about to recall the Authenticated user to my controller but suddenly it returns null. I don't have this problem in laravel 5. here's the code: my web route: Auth::routes(); Route::middleware('auth')->group(function () { ... …
jp.palubs
  • 178
  • 1
  • 14
2
votes
5 answers

Laravel 6: Call to undefined method App\\User::createToken()

I'm trying to generate a token to authenticate users in my Controller the following way: namespace App\Http\Controllers\API; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use…
MrCujo
  • 1,218
  • 3
  • 31
  • 56
2
votes
1 answer

laravel: how to stay login until a condition becomes false?

I have a field (can_login) in my users table. normally,users can login. and logout with this code: Auth::logout(); I want, when each time a logged-in user refresh a page, laravel check can_login in user table. if can_login is false, then auto…
ali ali
  • 161
  • 2
  • 8