PHP code example of krak / lava-oauth2
1. Go to this page and download the library: Download krak/lava-oauth2 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/ */
krak / lava-oauth2 example snippets
use Krak\LavaOAuth2;
$app->with(new LavaOAuth2\OAuth2Package());
$app['krak.lava_oauth2']['private_key'] = $app->basePath('oauth-private.key');
$app['krak.lava_oauth2']['public_key'] = $app->basePath('oauth-public.key');
$app['krak.lava_oauth2']['grants'] = [
'client_credentials' => true,
'access_token_ttl' => new \DateInterval('PT2H'),
];
$app->httpStack()->push($app['krak.lava_oauth2']['resource_server_middleware']);
$app->httpStack()->push(mount('/oauth', $app['krak.lava_oauth2']));