PHP code example of xabbuh / oauth1-authentication
1. Go to this page and download the library: Download xabbuh/oauth1-authentication 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/ */
xabbuh / oauth1-authentication example snippets
use ApiClients\Tools\Psr7\Oauth1\Definition\ConsumerKey;
use ApiClients\Tools\Psr7\Oauth1\Definition\ConsumerSecret;
use ApiClients\Tools\Psr7\Oauth1\RequestSigning\RequestSigner;
$requestSigner = new RequestSigner(
new ConsumerKey('consumer_key'),
new ConsumerSecret('consumer_secret')
);
// ...
use ApiClients\Tools\Psr7\Oauth1\Definition\AccessToken;
use ApiClients\Tools\Psr7\Oauth1\Definition\TokenSecret;
use Xabbuh\Http\Authentication\OAuth1;
// ...
$oauth = new OAuth1(
$requestSigner,
new AccessToken('access_token'),
new TokenSecret('token_secret')
);
// ...
use Http\Discovery\HttpClientDiscovery;
use Http\Client\Common\PluginClient;
use Http\Client\Common\Plugin\AuthenticationPlugin;
// ...
$authenticationPlugin = new AuthenticationPlugin($oauth);
$pluginClient = new PluginClient(
HttpClientDiscovery::find(),
[$authenticationPlugin]
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.