tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.29k stars 1.54k forks source link

Routes not working #1648

Open softwareishappiness opened 6 years ago

softwareishappiness commented 6 years ago

I followed the quick start at: https://jwt-auth.readthedocs.io/en/develop/quick-start/. After copying the code from this tutorial to my routes/api.php and created an AuthController.php (also) using source on that tutorial. The route is not found-- the standard, familiar Laravel page:

Sorry, the page you are looking for could not be found.

I looked in Kernel.php and there was not middleware? Not sure what to do. Ideas? Really would like to use JWT but may have to go back to Passport.

Another tutorial on Medium.com at: https://medium.com/@mosesesan/tutorial-5-how-to-build-a-laravel-5-4-jwt-authentication-api-with-e-mail-verification-61d3f356f823 from about 1 yr ago indicated that the Kernel.php needed to updated. Moreover, routing is slightly different in that tutorial.

Please let me know where a working implementation maybe found for Laravel 5.6, updated Quick Start documentation or describe what is happening (or not happening).

TobiasJ commented 6 years ago

Maybe a bit late but that's an easy fix. When you followed the instructions on the install guide and quick start you should be able to request the endpoints with the default laravel api route pattern which is my-domain.tld/api. What you were missing (where the guide isn't 100% correct) is the api prefix.

Testing the endpoints with localhost:8000/api/auth/login should be working as expected.