WebTolk Joomla Extensions
113 Extensions
12 Categories
587 Versions released
920737 Downloads
OauthEntity in WT CDEK for Joomla covers manual CDEK OAuth token retrieval. This reference explains its purpose, parameters and PHP examples for Joomla extensions.
OauthEntity retrieves OAuth tokens manually. Normal integrations authenticate automatically through CdekRequest; direct access is mainly for debugging and custom workflows.
Access the entity through the Cdek facade:
$oauth = $cdek->oauth();
getOAuthToken()public function getOAuthToken(array $request_options = []): array
POST /v2/oauth/tokenRequests an OAuth token directly.
All three fields are required: grant_type, client_id, client_secret. Use grant_type client_credentials.
An array with access_token, token_type, expires_in, or an error.
<?php
declare(strict_types=1);
use Webtolk\Cdekapi\Cdek;
defined('_JEXEC') or die;
$cdek = new Cdek();
$tokenData = $cdek->oauth()->getOAuthToken([
'grant_type' => 'client_credentials',
'client_id' => 'your_client_id',
'client_secret' => 'your_client_secret',
]);