Page History
...
Access and refresh tokens are strings used to identify a user
...
. The table below indicates the use for each type of token:
Token Type | Description |
---|
...
Access Token | This is required to grant access to the data provided by the API. |
...
Refresh Token | Use this to generate a new access token after the old one expires. This allows access to continue without the need to |
...
authenticate again. |
...
Use the "Create access and refresh token" method described below (and on Apiary here) to provide login credentials in exchange for both of these tokens. If you have multiple VideoManagers, the response will show which VideoManager the access token is assigned to. To gain access to a specific VideoManager, use the "Create refresh token" method described below (and on Apiary here).
Note |
---|
The URLs in the methods below refer to the general live instance of movingimage. Customers using a VideoManager on a custom domain must adjust the URLs accordingly. |
Create Access and Refresh Token Request
Code Block | ||||
---|---|---|---|---|
| ||||
curl -X POST -H "Content-Type: application/json" -d "{
'username':'<USERNAME>',
'password':'<PASSWORD>'
}" https://api.video-cdn.net/v1/vms/auth/login |
...
Sample Response
Code Block | ||||
---|---|---|---|---|
| ||||
{
"accessToken": <ACCESS_TOKEN>,
"refreshToken": <REFRESH_TOKEN>,
"videoManagerList": [{"id":<VIDEOMANAGER_ID>,"name":<VIDEOMANAGER_NAME>}, {...}],
"validForVideoManager": "<VIDEOMANAGER_ID>"
} |
An access token and a refresh token are granted after the user has successfully proven their identity through the authentication process. Acquisition of these tokens are done using the endpoints discovered in the previous chapter.
There are three different ways to proceed depending on the type of integration. Use the following table to determine which scenario to use:
Use Case | Description | Authorization Grant |
---|---|---|
Anonymous Users | Software that only accesses one VideoManager Pro account belonging to the application developer. Users don't need to have a VideoManager Pro account and can use the application anonymously. This should be the appropriate option for most integrations. | Resource Owner Password Credentials |
Browser Application | Software within a user's browser that redirects the user to allow them to login to their VideoManager Pro accounts. Here, a code is given to the browser and traded for an access token. | Authorization Code |
Server-side Application | Server-side software that redirects the user to allow them to login to their VideoManager Pro accounts. Here, a code is given to the server and traded for an access token. | Authorization Code |
Info |
---|
Note the authorization grant; this is the corresponding OAuth authorization grant (or flow) that is used to retrieve the access token. |
Create Refresh Token Request
Use this method if your accessToken expires to generate a new one. If you have access to more than one VideoManager, this method is also useful for specifying which VideoManager you would like to access.
Code Block | ||||
---|---|---|---|---|
| ||||
curl -X POST -H "Content-Type: application/json" -d "{
'refreshToken':'<REFRESH_TOKEN>'
}" https://api.video-cdn.net/v1/vms/auth/refresh/<VIDEOMANAGER_ID> |
...
Sample Response
Code Block | ||||
---|---|---|---|---|
| ||||
{
"accessToken": <ACCESS_TOKEN>,
"refreshToken": <REFRESH_TOKEN>,
"videoManagerList": [{"id":<VIDEOMANAGER_ID>,"name":<VIDEOMANAGER_NAME>}, {...}],
"validForVideoManager": "<VIDEOMANAGER_ID>"
} |
Using the Access Token
Once you have an access token that is valid for the desired VideoManager, you can use the rest of the API methods by including it in the header of each request. The following uses the "Get VideoManagers" method to demonstrate this:
...
language | text |
---|---|
theme | Confluence |
...