mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 17:56:14 +05:30
21 lines
708 B
PHP
21 lines
708 B
PHP
<?php
|
|
|
|
use League\OAuth2\Server\Grant\ClientCredentialsGrant;
|
|
use League\OAuth2\Server\Server;
|
|
use OAuth2ServerExamples\Repositories\AccessTokenRepository;
|
|
use OAuth2ServerExamples\Repositories\ClientRepository;
|
|
use OAuth2ServerExamples\Repositories\ScopeRepository;
|
|
|
|
include(__DIR__ . '/../vendor/autoload.php');
|
|
|
|
// Setup the authorization server
|
|
$server = new Server();
|
|
|
|
// Init our repositories
|
|
$clientRepository = new ClientRepository();
|
|
$scopeRepository = new ScopeRepository();
|
|
$accessTokenRepository = new AccessTokenRepository();
|
|
|
|
// Enable the client credentials grant on the server
|
|
$server->enableGrantType(new ClientCredentialsGrant($clientRepository, $scopeRepository, $accessTokenRepository));
|