Laravel login loop

22 views Asked by At

I have a Laravel 10 project (with Breeze) using Sanctum for authentication.

I have served my application and successfully registered myself as a user. But whenever I try to log in, I am immediately redirected back to the login page. No errors are thrown.

When I try to log in, I am successfully authenticated and a user session is created for me (I have confirmed this). But when the GET request for the home page is sent, it returns code 302 (200 expected) and redirects me to the login page.

Again, no errors and from my debug logs I can see that a session has been created for me. The session cookie and XSRF-TOKEN are included in my requests.

I've had a careful look at my config files, but no 'aha' moment...

Any suggestions on where the problem might lie are greatly appreciated!

1

There are 1 answers

0
Johan On

Solved! Issue was related to custom middleware that allowed me to make a user inactive. Unfortunately, this defaulted to false for new users. Thus, I could not log in because I was automatically inactive.