PHP code example of relictos / oauth2-bnet

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

    

relictos / oauth2-bnet example snippets


$provider = new \Depotwarehouse\OAuth2\Client\Provider\SC2Provider([
    'clientId' => "YOUR_CLIENT_ID",
    'clientSecret' => "YOUR_CLIENT_SECRET",
    'redirectUri' => "http://your-redirect-uri",
    'region' => 'eu'
]);

if (isset($_GET['code']) && $_GET['code']) {
    $token = $this->provider->getAccessToken("authorizaton_code", [
        'code' => $_GET['code']
    ]);

    // Returns an instance of Depotwarehouse\OAuth2\Client\Entity\SC2User
    $user = $this->provider->getResourceOwner($token);