PHP code example of tinect / oauth2-storefront-login
1. Go to this page and download the library: Download tinect/oauth2-storefront-login 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/ */
tinect / oauth2-storefront-login example snippets
use Tinect\OAuth2StorefrontLogin\Contract\ClientContract;
use Tinect\OAuth2StorefrontLogin\Contract\ClientProviderContract;
use Symfony\Component\OptionsResolver\OptionsResolver;
final class MyProviderClientProvider extends ClientProviderContract
{
public function provides(): string
{
return 'my_provider';
}
public function getConfigurationTemplate(): OptionsResolver
{
$resolver = parent::getConfigurationTemplate();
$resolver->setRequired(['clientId', 'clientSecret']);
$resolver->setAllowedTypes('clientId', 'string');
$resolver->setAllowedTypes('clientSecret', 'string');
return $resolver;
}
public function provideClient(array $resolvedConfig): ClientContract
{
return new MyProviderClient($resolvedConfig);
}
}