diff --git a/docs/server-api/access-token.md b/docs/server-api/access-token.md index aa0b68e9..37b3f6c8 100644 --- a/docs/server-api/access-token.md +++ b/docs/server-api/access-token.md @@ -3,8 +3,36 @@ sidebar_position: 7 --- # Access token +An access token is essential for secure video playback . + +### Create an Access token + +To generate the Access token you need to send an HTTP POST request to the API Endpoint, with the [authentication Header](../server-api/authentication.md) and the optional Access token request Body. + +```bash +https://app.tpstreams.com/api/v1/{{org_code}}/assets/{{asset_id}}/access_tokens/ +``` + +**Optional Fields** + +| Name | Type | description | +| ----------- | ----------- | ----------- | +| time_to_live | integer | By default, the Access token validity is set to infinity. You can create shorter-lived URLs by passing the time_to_live parameter. This value is to be set in seconds | +| expires_after_first_usage | boolean | Passing true will make the access token expire immediately after the first usage | +| annotations | json | JSON contain all the information about the watermark. Please refer to this [doc](../video-embedding/watermarking.md) for details on watermarking. | + +For valid requests the API server returns a JSON: + +```js +{ + "playback_url":"https://app.tpstreams.com/embed/dcek2m/6cKHaeJ44pp/?access_token=1a60b175-c2e8-4a38-814b-323697f52994", + "expires_after_first_usage":false, + "code":"1a60b175-c2e8-4a38-814b-323697f52994", + "status":"Active","valid_until":null, + "annotations":[] +} +``` -For Creation API, Please check [here](../video-embedding/authentication.md) ### List Access tokens diff --git a/docs/video-embedding/authentication.md b/docs/video-embedding/authentication.md index 927f3e55..c874be09 100644 --- a/docs/video-embedding/authentication.md +++ b/docs/video-embedding/authentication.md @@ -11,42 +11,4 @@ If the user has your video embed code he can embed your video onto any page on t You can prevent the above scenario by generating an access token using API with time-to-live or set to expire after one usage on the back-end server and then sent to the website front-end and use generate access_token as part of the video embed code. -### Obtaining an Access token - -To generate the Access token you need to send an HTTP POST request to the API Endpoint, with the [authentication Header](../server-api/authentication.md) and the optional Access token request Body. - -```bash -https://app.tpstreams.com/api/v1/{{org_code}}/assets/{{asset_id}}/access_tokens/ -``` - -**Optional Fields** - -| Name | Type | description | -| ----------- | ----------- | ----------- | -| time_to_live | integer | By default, the Access token validity is set to infinity. You can create shorter-lived URLs by passing the time_to_live parameter. This value is to be set in seconds | -| expires_after_first_usage | boolean | Passing true will make the access token expire immediately after the first usage | -| annotations | json | JSON contain all the information about the watermark. Please refer to this [doc](./watermarking.md) for details on watermarking. | - -For valid requests the API server returns a JSON: - -```js - -{ - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "playback_url": "https://app.tpstreams.com/embed/dcek2m/3XqS4b4UKUm/?access_token=b1aa3af8-9c75-40e9-a051-4c129e84da82", - "expires_after_first_usage": false, - "code": "b1aa3af8-9c75-40e9-a051-4c129e84da82", - "status": "Active", - "valid_until": null, - "annotations": [] - } - ] -} -``` - - -Other CRED operation APIs are documented [here](../server-api/access-token.md) \ No newline at end of file +Access token CRUD operation APIs are documented [here](../server-api/access-token.md) \ No newline at end of file