All Questions
Tagged with laravel authentication
3,395 questions
140
votes
25
answers
661k
views
Laravel: Auth::user()->id trying to get a property of a non-object
I'm getting the following error "trying to get a property of a non-object" when I submit a form to add a user, the error is apparently on the first line: Auth::user()->id of the following:
$id = Auth:...
97
votes
3
answers
90k
views
Laravel What is a guard?
I was looking through the built in auth controllers and I noticed they use something called "Guards". Up until now whenever I made my own logins/register forms I never touched these and would usually ...
65
votes
5
answers
150k
views
Laravel: What is "remember_token" in the "users" DB table?
Is it safe to use the remember_token in the users table for authenticating the user into the application?
What is the purpose of this token? Currently, I'm using it in forms to check whether the user ...
57
votes
12
answers
178k
views
How validate unique email out of the user that is updating it in Laravel?
I am using Laravel 5.2 and want to update user's account using validator.
I want to keep email field unique, but, if the user type his current email it will break. How can I update if the email is ...
43
votes
13
answers
49k
views
Laravel 5.5 change unauthenticated login redirect url
In Laravel < 5.5 I could change this file app/Exceptions/Handler to change the unauthenticated user redirect url:
protected function unauthenticated($request, AuthenticationException $exception)
{
...
40
votes
3
answers
30k
views
OAuth or JWT? Which one to use and why?
I am starting to learn about token based authentication and I am trying to learn how to implement it in Laravel 5. I have come across two very popular technologies for doing this but I am confused ...
39
votes
3
answers
42k
views
Laravel - How to get current user in AppServiceProvider
So I am usually getting the current user using Auth::user() and when I am determining if a user is actually logged in Auth::check. However this doesn't seem to work in my AppServiceProvider. I am ...
38
votes
11
answers
46k
views
Jwt Authentication error Argument 3 passed to Lcobucci\JWT\Signer\Hmac::doVerify()
I'm working on a project to learn laravel, I saw a couple of tutorials to use jwt auth in this. It was working good but now is show an error not always but I don't know why. this is it:
Argument 3 ...
38
votes
7
answers
125k
views
Laravel 5 check whether a user is logged in
I am new to Laravel 5 and trying to understand its Auth process. I want to prevent user to reach some of my pages unless the user is not logged in. Trying to make it with Route:filter but it does not ...
38
votes
4
answers
40k
views
Authenticate users from more than two tables in laravel 5 [duplicate]
As I know Auth::attempt is used to authenticate users from users table, but i want to authenticate another users from managers table and admin from admins table. I know there are laravel-multiauth ...
35
votes
24
answers
100k
views
Login only if user is active using Laravel
I'm currently working on my Laravel app and to prevent spam I decided that only active users are able to login.
I'm currently using Laravel's login system just like in Laravel's official website ...
34
votes
11
answers
39k
views
Laravel Auth:attempt() will not persist login
I have found many resources online with similar issues but none of the solutions appear to solve my problem.
When I log a user in with the following code, everything seems fine:
$email = Input::get('...
32
votes
12
answers
69k
views
Prevent Browser's Back Button Login After Logout in Laravel 5
I am new to Laravel 5 and trying to make a simple authentication page. My problem is i can logout properly after i click to logout link but if i click to back button of the browser, still able to see ...
27
votes
4
answers
89k
views
Which to use Auth::check() or Auth::user() - Laravel 5.1?
If I want to check whether the user is logged in within my Laravel 5.1 application I can either use
if (Auth::user()) {...}
or
if (Auth::check()) {...}
is there a reason to prefer one over the ...
26
votes
7
answers
33k
views
Laravel redirect with logout not working
I am Using laravel 4 framework's. When I used redirect after the Auth::logout(), the redirection was not working. I used View::make() too, but same "Whoops, looks like something went wrong." error ...