PHP code example of slowprog / oauth2-modulbank

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

    

slowprog / oauth2-modulbank example snippets


$provider = new \League\OAuth2\Client\Provider\Modulbank([
    'clientId'          => '{modulbank-client-id}',
    'clientSecret'      => '{modulbank-client-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'debug'             => false
]);

// Get url for registration which must transfer to browser (send GET)
// $url = $provider->getRegistrationUrl($firstName, $lastName, $email, $cellPhone);
// Or
// Get url for authorization which must transfer to browser (send POST)
$url = $provider->getAuthorizationUrlShort();
$params = $provider->getAuthorizationParams([
    'scope' => 'account-info operation-history assistant-service money-transfer',
]);

$provider = new \League\OAuth2\Client\Provider\Modulbank([
    'clientId'          => '{modulbank-client-id}',
    'clientSecret'      => '{modulbank-client-secret}',
    'debug'             => false
]);

$token = $provider->getAccessToken('authorization_code', [
    'code' => $code
]);

// Use this to interact with an API on the users behalf
echo $token->getToken();

$provider = new \League\OAuth2\Client\Provider\Modulbank([
    'clientId'          => '{modulbank-client-id}',
    'clientSecret'      => '{modulbank-client-secret}',
    'token'             => '{modulbank-client-token}',
    'debug'             => false
]);

$info = $provider->getAccountInfo();
// $history = $provider->getOperationHistory('9f65fff4-d638-41d8-83eb-a616039d3fe5');
// $balance = $provider->getBalance('9f65fff4-d638-41d8-83eb-a616039d3fe5');

$params = $provider->getAuthorizationParams([
    'scope' => 'assistant-service money-transfer',
]);