Category: Laravel, PHP, api, javascript

For my current project I am building a single page Vue application that communicates with a Laravel backend using only API calls. This means the default methods that Laravel provides for user registration and password recovery need to be overridden in several places in order to the replace web pages with JSON responses.

There’s also not much documentation on this topic that is up to date with Laravel 7, so it wound up taking me a bit of trial and error to piece everything together.

Its important to note that in Laravel 7, the default Authentication code was moved out of Laravel core and in to Laravel UI.

There are actually several ways we can do this, but the quickest and easiest way is to simply add the following code to the “boot” method of your App/Providers/AppServiceProviders.php file with the url to your frontend password reset form: You can also check out this post from Stack Overflow for alternate ways of handling this in Laravel.

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Community Partners