PHP code example of yutiandev / laravel-passport-multiauth

1. Go to this page and download the library: Download yutiandev/laravel-passport-multiauth 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/ */

    

yutiandev / laravel-passport-multiauth example snippets


    'providers' => [
        ...
        YTDev\LPM\MultiAuthServiceProvider::class,
    ]

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model'  => App\User::class,
            'client_id' => 2,
        ],
        'admins' => [
            'driver' => 'eloquent',
            'model'  => App\Admin::class,
            'client_id' => 4, 
        ]  
    ]

public function token()
{
    $client = new GuzzleHttp\Client();
    
    $response = $http->post('http://your-app.com/oauth/token', [
        'form_params' => [
            'grant_type' => 'password',
            'client_id' => \YTDev\LPM\Facades\PassportMultiAuth::clientId(),
            'client_secret' => 'client-secret',
            'username' => '[email protected]',
            'password' => 'my-password',
            'scope' => '',
        ],
    ]);
    
    return json_decode((string) $response->getBody(), true);
}
config/auth.php