From the course: Building Laravel and Vue.js 2 Web Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Building an API with Laravel Passport

Building an API with Laravel Passport

From the course: Building Laravel and Vue.js 2 Web Apps

Start my 1-month free trial

Building an API with Laravel Passport

- [Instructor] In this video, we'll build an API with token authentication using Laravel Passport. For actions that will invoke with Ajax, we could put the routes here in web.php and rely on the same cookie-based sessions for authentication, but it's nice to keep them separate in this API routes file which is in the same folder. This API guard used here uses token authentication by default, and it's also nice to build a universal API with that token authentication in case you need it later, for instance, for a completely separate app, web or mobile, or for third party integrations with your system. We can setup an API without much effort at all using Laravel Passport which is a complete OAuth2 server and API authentication package. You can install it with composer. Just type composer require laravel\passport. Passport comes with migrations, although they won't be placed in the normal migrations folder. So next, we'll run artisan migrate to create the tables to store the API access…

Contents