I have a application that uses an external LDAP server for authentication, and is mostly a (GraphQL! :D) API. This application will basically just be an API, so I need API authentication. I tried using Passport, but unfortunately, it doesn't work in conjunction with the LDAP authentication driver I'm using. In the ideal world I'd use it, but there simply isn't enough time for this project to get the two to talk. The frontend developer on this project actually likes that we're not using Passport because that means he doesn't have to do a full OAuth integration. We're going to use a modified version of the TokenGuard from Laravel Spark (yes I have a license) for the authentication. This means it'll be like Passport, but simplified. The API doesn't have any clients except for the website we're building ourselves, so the fact that we're missing that aspect from OAuth is not an issue.
Anyway, the frontend still needs to be able to retreive tokens from the application so I want to RESTify the
/login endpoint so that you can just sent a username and password to it, and if they're correct, it'll spit out a token for you to use. The problem is that I still want to use the
AuthenticatesUsers trait, since it makes sure that the LDAP driver is automatically used, it'll throttle login requests etc etc.
How is it possible to keep using the
AuthenticatesUsers trait but reply with a JSON response instead of redirecting the user to