PHP code example of aslaluroba / babylai_php_auth_client
1. Go to this page and download the library: Download aslaluroba/babylai_php_auth_client 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/ */
aslaluroba / babylai_php_auth_client example snippets
BabylAI\Client\BabylAiAuthClient;
$tenantId = '#####'; // replace with your TenantId
$apiKey = '#####'; // replace with your API key
$client = new BabylAiAuthClient('https://babylai.net/api/');
try {
$resp = $client->getClientToken($tenantId, $apiKey);
echo "Token: " . $resp->getToken() . PHP_EOL;
echo "Expires in: " . $resp->getExpiresIn() . " seconds" . PHP_EOL;
} catch (\Exception $ex) {
echo "Error: " . $ex->getMessage() . PHP_EOL;
}
ini
BABYLAI_TENANT_ID=2176c188-8cb4-4fc3-8366-2d32e601f7e5
BABYLAI_API_KEY="I/22UK34I6xAhglfPXTwPAgUuVyJw8TdnG26ZLI5gYQ="
BABYLAI_BASE_URL="https://babylai.net/api/"