PHP code example of japostulo / middleware-passport

1. Go to this page and download the library: Download japostulo/middleware-passport library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

japostulo / middleware-passport example snippets


protected $routeMiddleware = [
        'sso.client' => \Japostulo\MiddlewarePassport\Middlewares\ClientAuthenticate::class,
        'sso.password' => \Japostulo\MiddlewarePassport\Middlewares\PasswordAuthenticate::class,
    ];

Route::middleware('sso.client')->get('/test-authenticated', function () {
        return response()->json("I'm authenticated");
});

Route::middleware('sso.password')->get('/test-introspect', function () {
    return response()->json(Auth::user());
});