Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 949 Bytes

oauth2-client.md

File metadata and controls

33 lines (24 loc) · 949 Bytes

Fetching OAuth2 Client through gRPC

<?php

use OAT\Library\EnvironmentManagementClient\Repository\OAuth2ClientRepositoryInterface;
use OAT\Library\EnvironmentManagementClient\Grpc\OAuth2ClientRepository;

class MyService {
    /** @var OAuth2ClientRepositoryInterface  */
    private $oAuth2ClientRepository;
    
    public function __construct(OAuth2ClientRepositoryInterface $oAuth2ClientRepository)
    {
        $this->oAuth2ClientRepository = $oAuth2ClientRepository;
    }
    
    public function myMethod(): void
    {
        //...
        
        $oAuth2Client = $this->oAuth2ClientRepository->find('client-1');
        
        //...
    }
}

$myService = new MyService(new OAuth2ClientRepository());
$myService->myMethod();