Type to search...

Access token for URL generation

About

URL access token can be used for URL generation, likewise the apiKey and imageSecret basic security combination. The difference between them is in the use cases. While the basic URL security is a general and unlimited URL security tool, the URL access token has many image hosting features, also it can be generated only through API.

Features

Expiry

Required parameter, timestamp when the access token will be expired. After this time, it can’t be used again. Practical, when we want to limit the access of the URL. The value must be more then the actual timestamp.

Limit

Required parameter, adds access limitation to the URL. The value must be at least 1.

Extra features

Extra access token features, required for using URL access token to create URLs.

Secret

Required secret string for URL creation.

Cloud ID

Optional parameter, if set, the access token will be limited to the given Cloud.

Authentication

Optional feature, adds HTTP authentication to the created URL. Multiple username/password pair can be added to the token.

SDK examples

use shardimage\shardimagephp\models\accesstoken\ImageUrlAccessToken;
use shardimage\shardimagephp\models\accesstoken\ImageUrlAccessTokenExtra;
use shardimage\shardimagephp\models\accesstoken\ImageUrlAccessTokenExtraAuthentication;
use shardimage\shardimagephp\models\accesstoken\MixedShaPasswordHash;
 
$auth = new ImageUrlAccessTokenExtraAuthentication();
$auth->setAuthenticationData('<username1>', new MixedShaPasswordHash('<password1>'));
$auth->setAuthenticationData('<username2>', '<password2>'); // plain text passwords will be encoded on the API side before storing
$token = new ImageUrlAccessToken();
$token->expiry = time() + 3600;
$token->limit = 10;
$token->extra = new ImageUrlAccessTokenExtra([
    'cloudId' => '<cloudId>',
    'secret' => '<secret>',
    'authentication' => $auth
]);
$token = $this->client->accessToken()->create($token);
Table of contents