Installation
You need to install the Introspection Server package on your authorization server.
Package Installation
On your Authorization Server, run the following:
composer require datahivedevelopment/passport-introspection-server
This package supports auto-discovery so you do not need to register the service provider manually.
But, if you need to, in config\app.php
:
/*
* Package Service Providers...
*/
DataHiveDevelopment\PassportIntrospectionServer\IntrospectionServiceProvider::class,
Migrations
The Introspection Server package has one migration to modify the Laravel Passport oauth_clients
table and add a can_introspect
column. You can read how to disable and publish them here.
Passport Installation
If you haven’t already done so, make sure you follow Passport’s Installation docs.
php artisan migrate
php artisan passport:install
Add the Laravel\Passport\HasApiTokens
trait to your App\User
class and register the Passport routes in your AuthServiceProvider
:
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
use Laravel\Passport\Passport;
class AuthServiceProvider extends ServiceProvider
{
// ...
public function boot()
{
$this->registerPolicies();
Passport::routes();
}
}
It is recommended that you use some sort of authorization on the introspection route. We recommend that you use the Client Credentials
grant so you will want to make sure you register the CheckCredentials
middleware in your app/Http/Kernel.php
file:
use Laravel\Passport\Http\Middleware\CheckClientCredentials;
protected $routeMiddleware = [
'client' => CheckClientCredentials::class,
];
Last updated
Was this helpful?