Independent Authentication Guard - log in issue #10450
-
Hi, I'm testing out to see whether it's possible to add Statamic to an existing Laravel app, but have the Laravel users separate (in a DB) to the Statamic users (in files) as we would only have one or a few users actually editing the Statamic side through the /cp. I've been following this guide exactly: https://statamic.dev/tips/using-an-independent-authentication-guard but I seem to be getting this error:
After some further digging, it looks like it was still trying to use the eloquent driver and was expecting a 'model' in the config/auth.php 'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => \App\Models\User::class,
],
'statamic' => [
'driver' => 'statamic',
// expecting a 'model' here...
],
], However, I figured out that it was still using the eloquent repository in 'repository' => 'file', All of this was tested on a brand new Laravel install (v11.15.0) with Statamic installed using this guide https://statamic.dev/installing/laravel before I try it on a more developed project. Any thoughts? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 21 replies
-
The same issue for me which is the login page accepts the credentials (which is the correct one) but nothing else happens after that. The login form is empty without letting users in. |
Beta Was this translation helpful? Give feedback.
-
As for the
Setting the In my case though, it worked fine at this point. I wasn't able to get the "doesn't actually log the user in" behavior. I've update the Laravel install and separate auth guard docs in a couple of places to make some things clearer. |
Beta Was this translation helpful? Give feedback.
-
Whoops, just reposting here.. Thanks for looking into this! Just curious, what I looked into this further and it could be related to
And this also works:
But this doesn't work (and this is where I get the "doesn't actually log the user in" behavior):
I had a suspicion this might've been the case as when I attempted to log into the /cp, it logged the Laravel user out (in addition to the form not jiggling for wrong credentials and instead just flashed). Any idea why I have noticed that in the @huuvan20 were you using Side note - either way (when it is working), logging out of the /cp also logs out the Laravel user. Is this intended behavior? I'm guessing so based on the single session. |
Beta Was this translation helpful? Give feedback.
Great! We can likely just mention in the docs that you may need to change the column type. I've added it to our
docs
repository: statamic/docs#1475