1. Go to this page and download the library: Download micro/plugin-oauth2-client 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/ */
use use Micro\Plugin\OAuth2\Client\Facade\Oauth2ClientFacadeInterface;
/** Unauthorized user */
$client = $container->get(Oauth2ClientFacadeInterface::class);
$provider = $client->getProvider('default');
$provider->getAuthorizationUrl(); This method will return the full path to the server for user authorization.
/*** Response from the authorization server with a code */
$accessToken = $provider->getAccessToken('authorization_code', [
'code' => $_GET['code'],
]);
$owner = $provider->getResourceOwner($accessToken);
$id = $owner->getId();
$ownerData = $owner->toArray(); //Associated data with the user.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.