25.06.2018 Views

Full-Stack Vue.js 2 and Laravel 5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Adding a User Login <strong>and</strong> API<br />

Authentication with Passport<br />

In the last chapter, we allowed the user to save their favorite <strong>Vue</strong>bnb listings.<br />

This feature was only implemented in the frontend app though, so if the user<br />

reloaded the page their selections would be lost.<br />

In this chapter, we'll create a user login system <strong>and</strong> persist saved items to the<br />

database so they can be retrieved after a page refresh.<br />

Topics covered in this chapter:<br />

Setting up a user login system utilizing <strong>Laravel</strong>'s built-in authentication<br />

features<br />

Creating a login form with CSRF protection<br />

Using <strong>Vue</strong>x actions for asynchronous operations in the store<br />

A brief introduction to the OAuth protocol for API authentication<br />

Setting up <strong>Laravel</strong> Passport to allow authenticated AJAX requests

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!