I use this code:
require_once __DIR__."/vendor/autoload.php";
use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\PasswordGrant;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
$clientRepository = new ClientRepository();
But I get error:
Fatal error: Uncaught Error: Class 'ClientRepository' not found in /home/a/public_html/app/oauth2.php:23 Stack trace: #0 {main} thrown in /home/a/public_html/app/oauth2.php on line 23
Maybe, you forgot namespace:
require_once __DIR__."/vendor/autoload.php";
use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Exception\OAuthServerException;
use League\OAuth2\Server\Grant\PasswordGrant;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
use NamespaceClass\ClientRepository; <-- edit
$clientRepository = new ClientRepository();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.