Lumen Installation (incomplete) - jwt | tymon jwt auth lumen
InstallviacomposerRunthefollowingcommandtopullinthelatestversion:composerrequiretymon/jwt-authBootstrapfilechanges.Addthefollowingsnippettothebootstrap/app.phpfileundertheproviderssectionasfollows://Uncommentthisline$app->register(AppProvidersAuthServiceProvider::class);//Addthisline$app->register(TymonJWTAuthProvidersLumenServiceProvider::class);Thenuncommenttheauthmiddlewareinthesamefile:$app->routeMiddleware([auth=>AppHttpMiddlewareAuthenticate::class,]);GeneratesecretkeyIhave...
Install via composerRun the following command to pull in the latest version:
composer require tymon/jwt-auth Bootstrap file changes.Add the following snippet to the bootstrap/app.php file under the providers section as follows:
// Uncomment this line $app->register(AppProvidersAuthServiceProvider::class); // Add this line $app->register(TymonJWTAuthProvidersLumenServiceProvider::class);Then uncomment the auth middleware in the same file:
$app->routeMiddleware([ auth => AppHttpMiddlewareAuthenticate::class, ]); Generate secret keyI have included a helper command to generate a key for you:
php artisan jwt:secretThis will update your .env file with something like JWT_SECRET=foobar
It is the key that will be used to sign your tokens. How that happens exactly will depend on the algorithm that you choose to use.