1. Go to this page and download the library: Download renanivo/authoritarian 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/ */
renanivo / authoritarian example snippets
use Authoritarian\OAuth2;
use Authoritarian\Flow\ClientCredentialsFlow;
$flow = new ClientCredentialsFlow();
$flow->setClientCredential('client id', 'client secret');
$oauth2 = new OAuth2('http://example.com/oauth/token');
$token = $oauth2->requestAccessToken($flow)->json();
use Authoritarian\OAuth2;
use Authoritarian\Flow\AuthorizationCodeFlow;
$flow = new AuthorizationCodeFlow();
$flow->setAuthorizationUrl('http://example.com/oauth/authorize');
$flow->setClientCredential('client id', 'client secret');
$flow->setRedirectUri('http://example.com/callback');
header('Location: ' . $flow->getAuthUrl());
use Authoritarian\OAuth2;
use Authoritarian\Flow\AuthorizationCodeFlow;
$flow = new AuthorizationCodeFlow();
$flow->setClientCredential('client id', 'client secret');
$flow->setCode($_GET['code']);
$oauth2 = new OAuth2('http://example.com/oauth/token');
$token = $oauth2->requestAccessToken($flow)->json();
use Authoritarian\OAuth2;
use Authoritarian\Flow\ResourceOwnerPasswordFlow;
$flow = new ResourceOwnerPasswordFlow(
'username',
'password'
);
$flow->setClientCredential('client id', 'client secret');
$oauth2 = new OAuth2('http://example.com/oauth/token');
$token = $oauth2->requestAccessToken($flow)->json();
bash
php composer.phar
bash
curl -sS http://apigen.org/installer | php
bash
php apigen.phar generate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.