Skip to main content
Skip table of contents

CreateAccessToken. Authorizаtion

Creating an OAuth token for playing a stream with Private access.

This method does not check if the stream exists on the server, which allows generating a token for playing the stream on any other server with the same secret (see Mediaserver/Configuration/Server (mediaserver.ini)).

POST /api/auth/token/access/
Body
json
JSON
{
    "uid": "stream-uid",
    "user": "user-unique-id",
    "duration": 3600
}
tokenrequired
string
Authorization token for API requests. See Mediaserver/Web API/Authorization/CreateApiToken.
uidrequired
uid
UID of the stream for which access is required.
userrequired
string
User ID for whom the token is being generated.
durationrequired
int
Duration of the token's validity in seconds. 0 means the token has no expiration time.
Response
200
Returns a JSON string with the token for playing the stream.
JSON
"5pNZXnaNf3w_x6I6AkeeXYXPejw8u47erHTwSNVOejgEjJp4~"
403
Authentication error. Incorrect or missing access token for API, see Mediaserver/Web API/Authorization/CreateApiToken.
Example
JSON
curl -k --location --request POST 'https://localhost:8080/api/auth/token/access/?token=string' \
--header 'Content-Type: application/json \
--data-raw '{
    "uid": "stream-uid",
    "user": "user-unique-id",
    "duration": 3600
}'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.