Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : Update access token documentation #25

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion docs/server-api/access-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
40 changes: 1 addition & 39 deletions docs/video-embedding/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Access token CRUD operation APIs are documented [here](../server-api/access-token.md)