← All plugins
JWT Authentication for MoonShine
JWT Authentication for MoonShine Laravel admin panel. This package provides API mode support through JSON Web Tokens, allowing you to interact with your MoonShine admin panel programmatically. Simple setup and integration with custom authentication pipelines make it easy to secure your admin API endpoints.
JWT Authentication for MoonShine
A simple way to switch your admin panel to API mode and interact via tokens
Documentation
Requirements
- MoonShine 3+
- Laravel 10+
- PHP 8.2+
Installation
composer require moonshine/jwt
composer require moonshine/jwt
composer require moonshine/jwt
composer require moonshine/jwt
composer require moonshine/jwt
php artisan vendor:publish --provider="MoonShine\JWT\Providers\JWTServiceProvider"
php artisan vendor:publish --provider="MoonShine\JWT\Providers\JWTServiceProvider"
php artisan vendor:publish --provider="MoonShine\JWT\Providers\JWTServiceProvider"
php artisan vendor:publish --provider="MoonShine\JWT\Providers\JWTServiceProvider"
php artisan vendor:publish --provider="MoonShine\JWT\Providers\JWTServiceProvider"
Add the base64 encoded secret key to the JWT_SECRET variable in the .env file
JWT_SECRET=YOUR_BASE64_SECRET_HERE
JWT_SECRET=YOUR_BASE64_SECRET_HERE
JWT_SECRET=YOUR_BASE64_SECRET_HERE
JWT_SECRET=YOUR_BASE64_SECRET_HERE
JWT_SECRET=YOUR_BASE64_SECRET_HERE
Usage
MoonShineServiceProvider
protected function configure(MoonShineConfigurator $config): MoonShineConfigurator
{
return $config
->middlewares([])
->authPipelines([
JWTAuthPipe::class,
])
->authMiddleware(AuthenticateApi::class);
}
protected function configure(MoonShineConfigurator $config): MoonShineConfigurator
{
return $config
->middlewares([])
->authPipelines([
JWTAuthPipe::class,
])
->authMiddleware(AuthenticateApi::class);
}
protected function configure(MoonShineConfigurator $config): MoonShineConfigurator
{
return $config
->middlewares([])
->authPipelines([
JWTAuthPipe::class,
])
->authMiddleware(AuthenticateApi::class);
}
protected function configure(MoonShineConfigurator $config): MoonShineConfigurator
{
return $config
->middlewares([])
->authPipelines([
JWTAuthPipe::class,
])
->authMiddleware(AuthenticateApi::class);
}
protected function configure(MoonShineConfigurator $config): MoonShineConfigurator
{
return $config
->middlewares([])
->authPipelines([
JWTAuthPipe::class,
])
->authMiddleware(AuthenticateApi::class);
}