Now that we have built our API in the previous lesson, we need a way to protect it, so that only authenticated users can use it. We will do that by using Token Based Authentication that comes with Laravel by default.
Laravel comes with built-in token-based authentication, but the documentation on it is almost nonexisting. After I complete this lesson, I will write the documentation for it and send a PR to Laravel so that it gets included in the official documentation.
Using a native authentication system is pretty handy because you don't have to deal with integrating it with your framework, it just works.
In short, we will give each user a token, with which he can access the API and protect the routes that we want to require authentication. I will also show you three different ways of sending the token to the API for authentication.
Laravel makes implementing authentication very simple. We will implement authentication in our existing application.
In this tutorial, we will cover creating, updating, deleting and viewing all multilingual articles.
We will create a new Laravel application which connects to the API that we have built in the previous lessons.
Learn how to implement JWT authentication in your Lumen application the proper way.