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

code ?

0

Basically:

protected function attempt() {

		...

		if(isset($user->id) && Auth::loginUsingId($user->id)) {

			// if I do Auth::check() here I get TRUE
			return Redirect::to('xxx');

		} else {
			return Redirect::to('login')->with('error', '...');
		}

	}
Route::group(array('prefix' => 'xxx', 'before' => 'auth.yyy'), function() {
	...
});
Route::filter('auth.yyy', function() {
	// if I do Auth::check() here I get FALSE
});

Also if I put some wrong credentials I should get that error from attempt but I don't..so it should be something with session configuration..but everything works on production server..

Last updated 6 years ago.
0

Yes! that was exactly what I needed, just tell the problem to someone and than I figured out :D Thanks astroanu you've been very useful :))

0

so what was the solution?

0

I overlooked the session configuration with 'domain' => '..server-domain..' so that's why session didn't work on localhost..simple as that..my fault:)

0

Fry4u said:

I overlooked the session configuration with 'domain' => '..server-domain..' so that's why session didn't work on localhost..simple as that..my fault:)

What is it supposed to be set to? Mine is set to null, and it seems like I'm having the exact same issue you had.

0

On production server it is like this:

'domain' => '.domain.com',

On my localhost:

'domain' => null,

And it works fine..

Send the code of session.php (without comments:))

0

Well, it's currently set to null, so that doesn't seem to be the issue. I just went ahead and made my own postLogin() to overwrite the pre-existing one in AuthController and everything is working just fine now. I can't figure out for the life of me what was causing the problem!

0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Fry4u Fry4u fry4u Joined 28 Jul 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.