PHP code example of kslimani / laravel-passport-grant
1. Go to this page and download the library: Download kslimani/laravel-passport-grant 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/ */
kslimani / laravel-passport-grant example snippets
// "grants" is an array of user provider class indexed by grant type
'grants' => [
// 'acme' => 'App\Passport\AcmeUserProvider',
],
/**
* Validate request parameters.
*
* @param \Psr\Http\Message\ServerRequestInterface $request
* @return void
* @throws \League\OAuth2\Server\Exception\OAuthServerException
*/
public function validate(ServerRequestInterface $request);
/**
* Retrieve user instance from request.
*
* @param \Psr\Http\Message\ServerRequestInterface $request
* @return mixed|null
*/
public function retrieve(ServerRequestInterface $request);
namespace App\Passport;
use App\User;
use Psr\Http\Message\ServerRequestInterface;
use Sk\Passport\UserProvider;
class AcmeUserProvider extends UserProvider
{
/**
* {@inheritdoc}
*/
public function validate(ServerRequestInterface $request)
{
// It is not necessary to validate the "grant_type", "client_id",
// "client_secret" and "scope" expected parameters because it is
// already validated internally.
$this->validateRequest($request, [
'acme_id' => ['