Posts /

Serverless Implementation

POSTS
16 May 2018

Vidyo Tokens Introduction

Tokens

To connect to Vidyo.io, the VidyoClient SDK needs to pass a token. A token is a short-lived authentication credential that grants access to the Vidyo.io service on behalf of the developer to a specific user. When an endpoint requests access to the service, your application backend should generate a token and pass it on to the client application.

Important: Never generate a token in the client application itself - this exposes your DeveloperKey which can then be used by other developers.

How to Generate a Token

For each application, you must create a DeveloperKey and ApplicationID in the API Key section of the Vidyo.io site and securely store it in your application backend. Then, each time you need to grant access to the Vidyo.io service, you must generate a Token from the DeveloperKey and ApplicationID as described below and pass it to their endpoint application or the VidyoConnector application.

Tokens can be rather long (typically 200 characters or more), so plan accordingly.

DeveloperKey and ApplicationID are “static” in your application. You will also need to provide a user name and an expiration time whenever you need to generate a token for a user.

Developer Key

A DeveloperKey is a shared secret between the Vidyo.io service and the developer’s backend application. It is used to generate access tokens on the customer backend and should never be sent to the endpoint itself. Access to the DeveloperKey should be restricted since every token that is signed by it will be used for access and billing.

Application ID

The ApplicationID identifies your application when connecting to the Vidyo.io platform. You can automatically provision any user (for example, user1@ApplicationID) when generating a token.

User Name

A token is associated to a specific user in Vidyo.io. To that end, when a token is generated, a user name needs to be provided. The user name is an open-ended alphanumeric string ([a-z,A-Z,0-9]) of your choosing which will be provisioned on the fly.

Expiration

Each token has a lifetime. Its lifetime is determined when the token is generated by specifying the number of seconds until it expires.

Expiration ensures that access to the system is secure and isn’t open to abuse.

Samples

Python sample generator

python3 generateToken.py --key=rUlaMASgt1Byi4Kp3sKYDeQzo --appID=ApplicationID --userName=user1 --expiresInSecs=10000

Java sample generator

java -jar generateToken.jar --key=rUlaMASgt1Byi4Kp3sKYDeQzo --appID=ApplicationID --userName=user1 --expiresInSecs=10000

Node.js sample generator

node generateToken.js --key=rUlaMASgt1Byi4Kp3sKYDeQzo --appID=ApplicationID --userName=user1 --expiresInSecs=10000

C# sample generator

GenerateToken.exe --key=rUlaMASgt1Byi4Kp3sKYDeQzo --appID=ApplicationID --userName=user1 --expiresInSecs=10000

How to use the REST api

Get and prepare these four items to pass to the VidyoClient SDK.

Use the following curl command:

curl -H “Content-Type: application/json” -X POST https://trro08dgr7.execute-api.us-east-1.amazonaws.com/dev/token_generate -d ‘{“key”: “xxxx”, “appID”: “xxxx.vidyo.io”, “userName”: “xxx”, “expiresInSecs”: “999999999”}’


Twitter Facebook Google+