Skip to content

tunnel-conflux/laravel-auto-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Clone the repo in the following location

Laravel_Root/packages/tunnelconflux/auto-jwt

git clone https://github.com/TunnelConflux/auto-jwt.git .

Then append the following code block on Laravel composer.json

"repositories": [
    {
        "type": "path",
        "url": "packages/tunnelconflux/auto-jwt",
        "options": {
            "symlink": true
        }
    }
]

Then run composer require "tunnelconflux/auto-jwt" and php artisan jwt:secret

Now you are all set to go ahead !

Now have to implement JWTSubject in the Auth service provider model

<?php

namespace App;

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements JWTSubject
{
    use Notifiable;

    // Rest omitted for brevity

    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }
}


Follow JWT doc

Test

We build on Laravel 5.8

License

The Module is open-source software licensed under the MIT

Releases

No releases published

Packages

No packages published

Languages