Here you will learn how to use Laravel Breeze and Cookie.

  1. Install Laravel
  2. Install Laravel Breeze startup kit
  3. Add below line of codes in your .env file
Copy to Clipboard
Remember that top level domain should be same for your Laravel and your SPA application. e.g. localhost.

In your frontend application e.g. Vue.js, remember to send these parameters:

Copy to Clipboard

Now you will have a working backend and frontend cookie for authentication.

If you are using Postman for APIs, then remember to do these steps in your Postman.

  1. Create environment in your workspace:
Variable Type Initial value Current value
base_url default http://localhost:8000 http://localhost:8000
frontendUrl default http://localhost:3000 http://localhost:3000
XSRF-TOKEN default
  1. In Pre-request Scripts of your collection add below:
Copy to Clipboard

Now you have successfully create a Laravel and Vue.js project. Also you can test your APIs in Postman.