Sunday, 11 December 2016

Laravel JWT auth with vue.js

This post is about laravel JSON Web Token based authentication using the new version of vue.js.The vue.js 2.0 has been released you can check here.

Laravel JWT auth with vue.js

Here i'm using laravel 5.2

Install some command line tools:

NPM version 3.10.8
Nodejs version 6.9.1
vue-cli version 2.5.0
git version 2.10.2

User Model : In laravel set your database connection in your .env file and run the migration for the create users , passwords resets etc.I have moved the Users class into a Models folder.

php artisan migrate

mkdir app/Models

mv app/User.php app/Models

Edit app/Models/User.php, change the App namespace to App\Models.



namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable


To view the full source please check the repo.

Edit, config/auth.php. Update the authentication drivers user provider for the App\Models\User namespace change as follows.


'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\Models\User::class,


You can read the full article here :

Featured post

How to create dynamic schema in mongodb

Sometime what we need in our application is to create mongodb schema for collection and some of our collection schema are same but names are...

Popular Posts