tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.31k stars 1.54k forks source link

Doc for version 1.0.0-rc.1 #1340

Open jampack opened 7 years ago

jampack commented 7 years ago

is there any documentation available for version 1.0.0-rc.1 if we want to implement the latest version?

kinyou commented 7 years ago
  1. composer require tymon/jwt-auth 1.0.0-rc.1

  2. add something just like this config/app.php Tymon\JWTAuth\Providers\LaravelServiceProvider::class,

    aliases - array

    'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class, 'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,

  3. php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"

  4. php artisan jwt:secret

  5. last good luck with you , enjoy it!

jampack commented 7 years ago

@kinyou and rest of the document applies the same for newer version? i dont think so.

kinyou commented 7 years ago

@akkhan20 yes you are right , the <tymon/jwt-auth 1.0.0-rc.1> version is only use in laravel 5.5+

philliperosario commented 7 years ago

The 1.0.0-rc.1 version requires you to implement Tymon\JWTAuth\Contracts\JWTSubject on your user model too. You must then add the required methods, which are getJWTIdentifier() and getJWTCustomClaims().

public function getJWTIdentifier()
{
    return $this->getKey(); \\ Eloquent Model method
}

public function getJWTCustomClaims()
{
    return [];
}

See: #260

philliperosario commented 7 years ago

1355