This tutorial assumes you already know how to set up jQuery DataTables for your webpage, and at the least basic Laravel knowledge. Security concerns: This authentication solution is easier to do, compared to authentication using Laravel Passport, but using the latter would be more secure. Laravel’s API Token guard should only be used for trivial authentication, and NOT for authentication involving sensitive user data, etc.
To make sure that we use Laravel’s built-in API token authentication driver (or in some cases, people call this the “guard”), we edit config/auth.php like so: Note that for most projects, this is the default setting.
In your routes/web.php: Second, we make sure that the built-in token guard for Laravel is utilized for the API route.