1. Go to this page and download the library: Download doccheck/oauth2-doccheck 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/ */
doccheck / oauth2-doccheck example snippets
use Doccheck\OAuth2\Client\Provider\Doccheck;
use Doccheck\OAuth2\Client\Utils\Language;
session_start();
$provider = new Doccheck([
'clientId' => '{doccheck-client-id}',
'clientSecret' => '{doccheck-client-secret}',
'redirectUri' => 'https://example.com/callback-url',
'stateless' => false, // set true if client has basic license or to prevent state parameter
'authorizationLanguage' => Language::DE, // Optional: defaults to EN
]);
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
$authUrl = $provider->getAuthorizationUrl([
'scope' => ['email'], // Add $user = $provider->getResourceOwner($token);
// Use these details to create a new profile
printf('Hello %s!', $user->getEmail());
} catch (Exception $e) {
// Failed to get user details
exit('Oh dear... ' . $e->getMessage());
}
// Use this to interact with an API on the users behalf
// echo $token->getToken();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.