PHP code example of nyan02 / kphp_oauth2_keycloak

1. Go to this page and download the library: Download nyan02/kphp_oauth2_keycloak 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/ */

    

nyan02 / kphp_oauth2_keycloak example snippets

$token = $provider->getAccessToken($grant, ['code' => $_GET['code']]);
$user = $provider->getResourceOwner($token);