PHP code example of p9d / oauth2-toolkit
1. Go to this page and download the library: Download p9d/oauth2-toolkit 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/ */
p9d / oauth2-toolkit example snippets
$providers = [
'your-provider-name-here' => [
'configuration_endpoint' => 'https://<url>/realms/ACME/.well-known/openid-configuration',
'client_id' => 'XXXXXXXXXXXXX'
],
'google' => [
'configuration_endpoint' => 'https://accounts.google.com/.well-known/openid-configuration'
]
];
$factory = new \P9D\OAuth2Toolkit\OpenIdConfigurationFactory(
$providers,
\Symfony\Component\HttpClient\HttpClient::create()
);
# Access provider config via:
$provider = $factory->createForProvider('your-provider-name-here');