Installation - RTLer/laravel-oauth2-server GitHub Wiki
require this package by running composer require rtler/laravel-oauth2-server
then add Oauth2ServiceProvider
into serviceProviders
- laravel in config\app.php add this
'providers' => [
...
RTLer\Oauth2\Providers\Oauth2ServiceProvider::class,
...
],
- lumen add this into bootstrap/app.php
$app->register(RTLer\Oauth2\Providers\Oauth2ServiceProvider::class);
then publish the needed files using php artisan vendor:publish
it copy /vendor/rtler/laravel-oauth2/src/publish/config/oauth2.php to /config/oauth2.php
and /vendor/rtler/laravel-oauth2/src/publish/Oauth2/UserVerifier.php to /app/Oauth2/UserVerifier.php
config /app/Oauth2/UserVerifier.php class that use to login user and get user by identifier
then add middleware
- laravel in app/Http/Kernel.php add this
protected $routeMiddleware = [
...
'oauth' => \RTLer\Oauth2\Middleware\ResourceServerMiddleware::class,
...
]
- lumen
$app->routeMiddleware([
...
'oauth' => \RTLer\Oauth2\Middleware\ResourceServerMiddleware::class,
...
]);
after that change the config/oauth2.php base on your needs( Generating public and private keys)