Support the ongoing development of Laravel.io →
Authentication Security Session
Last updated 3 months ago.
0

After digging a bit, I discovered my problem.

First, I dropped using Auth::check() and began using Auth::user(). When I called Auth::user(), I discovered I had set the incorrect value in my Eloquent model for what to return for getAuthIdentifier. I've since made it "return $this->attributes[$this->primaryKey]".

For those interested, this is my Eloquent model that I'm using for authentication. I highlighted the method.

http://laravel.io/bin/jQWXB#18-21

Some of the problems related to Auth::check() I believe was due to my use of dd() during debugging. I wasn't allowing the request to complete and thus wasn't writing back to my session appropriately. I'm not 100% certain on that, but I did see my session keys disappearing in Redis. That stopped happening once I returned a value instead of calling dd() and exiting the application.

Last updated 7 years ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

kreeves kreeves kreeves Joined 20 May 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.