PHP code example of autokz / oauth_proxy

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

    

autokz / oauth_proxy example snippets




$converter = new JWTConverter();

$configStorage = new DotEnvConfigStorage(__DIR__ . '/../'); // Path to .env file
$configStorage->load();

// Optional variable - Http client
$httpClient = new CurlHttpClient();

$proxy = new Proxy($converter, $configStore, $httpClient);

// Login
$username = new UsernameType('username');
$password = new PasswordType('password');
$oAuthData = $proxy->login($username, $password); // string|Exception 

// Logout
$oAuthData = 'crypted_and_converted_access_token_array_to_string';
$proxy->logout($oAuthData); // true|Exception

// Check
$oAuthData = 'crypted_and_converted_access_token_array_to_string';
$oAuthData = $proxy->check($oAuthData); // string|Exception

// Refresh
$oAuthData = 'crypted_and_converted_refresh_token_array_to_string';
$oAuthData = $proxy->refresh($oAuthData); // string|Exception