A simple demonstration to implement API authentication with JWT token.
A user logging into a web application should be able to generate an api key to authenticate apis related to the web application. In this use case the jwt token will not be created when the user logs in. Instead it will be generated by the user after login.
Copy the library and the middleware appropriately for this setup to work. It should work in any recent Laravel versions.
The JWT library used here does not belong to me. I have been using it for few years in the past but forgot from which Github repo I downloaded. If I am not wrong it should be this one. https://github.com/rpiambulance/website/blob/master/jwt_helper.php.
I hope this is useful to someone out there. Feel free to use it the way you want.