PHP code example of hrevert / ht-oauth-server-client-module

1. Go to this page and download the library: Download hrevert/ht-oauth-server-client-module 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/ */

    

hrevert / ht-oauth-server-client-module example snippets


'modules' => array(
    'ZfrOAuth2Module\Server',
    'HtLeagueOauthClientModule',
    'HtOauthClientModule', 
    'HtOauth\Server\ClientModule',
),

return [
    'doctrine' => [
        'entity_resolver' => [
            'orm_default' => [
                'Hrevert\OauthClient\Model\UserInterface' => 'Application\Entity\User'
            ]
        ]
    ]
]

return [
    'zfr_oauth2_server' => [
        'grants' => [
            // .. other grants,
            'HtOauth\Server\ClientModule\Grant\Oauth2Client',
        ]
    ]
]


return [
    'ht_oauth_service_client' => [
        'create_user_callable' => function(\HtLeagueOauthClientModule\Model\UserInterface $userDetails) {
            $user = ......;
            
            $userProvider = new \Hrevert\OauthClient\Entity\UserProvider();
            $userProvider->setUser($user);
            
            return $userProvider; 

            // or just

            $user = ......;

            return $user;
        }
    ]
];