Skip to content

This is a very sexy auth/login boilerplate for a PHP/Laravel and Vue.js application with bootstrap-vue. Token-based authentication (coupling Vue client with Laravel server) is achieved with Laravel Passport (an Oauth2 server implementation), and Vuex for client-side state management. Once authenticated, Vue-router takes user to a hello world das…

Notifications You must be signed in to change notification settings

baldmike/laravel_vue_auth_boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Vue Auth Boilerplate

Local Setup (Docker Optional)

cd laravel_vue_auth_boilerplate
cp example.env .env
cp docker-compose.yml.example docker-compose.yml

Tweak any settings in the docker-compose.yml, like database values.

If using Docker, spin up container (assumes you have docker desktop running):

docker-compose build && docker-compose up

Run the following commands to install dependencies:

Locally:

composer install

or using a container:

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  composer install

Locally:

npm install

or

from your container:

docker-compose exec php npm install

Locally:

php artisan key:generate

or

from your container:

docker-compose exec php php artisan key:generate

set up your database and update the following lines in .env file (this assumes a mysql db):

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE={ WHATEVER YOU NAMED YOUR SCHEMA }
DB_USERNAME={ YOUR USERNAME }
DB_PASSWORD={ YOUR PASSWORD }

For Docker you should match these values to the variables you use in the MySQL environment variables from your docker-compose.yml

run the migrations, seed db with admin, add passport tables (this gives you client (vue) token):

docker-compose exec php php artisan migrate
docker-compose exec php php artisan db:seed
docker-compose exec php php artisan passport:install

This will generate two keys, copy the 'secret' for id=2 (Laravel Password Grant Client) - this was created by passport:install, above, and is needed for Vue to connect. Then paste the following lines in .env file, using that 'secret':

PASSPORT_LOGIN_ENDPOINT = 'localhost:8000'
PASSPORT_CLIENT_ID={ Client ID }
PASSPORT_CLIENT_SECRET={ THE 'SECRET' OF LARAVEL PASSWORD GRANT CLIENT }

Once you've updated these values you can then run:

docker-compose exec php npm run live

This will first run through some compilation processes and then you'll be ready to run.

The project will be running on localhost:8000

You will need to get a user name from the database. Use the username and 'password' to login, you'll be taken to dashboard and adopt your next dog or cat from your local shelter or rescue group, please and thank you.

About

This is a very sexy auth/login boilerplate for a PHP/Laravel and Vue.js application with bootstrap-vue. Token-based authentication (coupling Vue client with Laravel server) is achieved with Laravel Passport (an Oauth2 server implementation), and Vuex for client-side state management. Once authenticated, Vue-router takes user to a hello world das…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •