Laravel 5.6 manual Authentication
When I started a new project I used make:auth()
to automatically build the scaffolding for logging in, registering etc, which was pretty cool out of the box.
I’ve come to the conclusion that I no longer need the scaffolding as in my new login method it checks your IP and depending on your IP you either get sent to Office 365 or you go through a local server to validate.
After all this I log in the user with Auth::login($user)
Essentially I like using Auth as it manages the session for logged in users but I don’t want the trait that redirects to the login or register forms.
I am having trouble finding what defines this behaviour, could I remove it and catch unauthenticated users myself, or is this a bad idea?
My overall aim is this:
- The user sends a POST request to the app either from an internal server or a small Office 365 login page.
- In this POST request there should be an email address, I use this as a check against the users table.
- If I find them I use Auth to log the user in so that I have access to the authenticated user.
I also know you can define an unauthenticated()
method but the issue I’m having to redirect to a method, which then redirects again.
from Laravel Questions and Answers https://laravelquestions.com/php/laravel-5-6-manual-authentication/
via Lzo Media
No comments:
Post a Comment