Suggestions

close search
Speed up your development
Create a Fast Track

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

Hello World

Set up a simple browser-based audio-video chat in a few minutes.

Prerequisites

Setting up basic OpenTok client-side code on the web is relatively simple, but you'll need a few things to make sure it works properly:

Set up a simple audio-video chat with OpenTok

Below is an editable HTML document loaded with the OpenTok.js library. Follow the steps under the HTML document to quickly set up a basic OpenTok chat.



Step 1 of 5: Authentication

Copy the code snippet below and add it to the HTML document under // credentials (use the copy button.)

 

var apiKey = '47905421';
var sessionId = '2_MX40NzkwNTQyMX5-MTc0MTUwMjY3MjQwM354LzJLcEk1VHpqa1FKSVB0L3JKd3FobFZ-UH5-';
var token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0NzkwNTQyMSIsImlzdCI6InByb2plY3QiLCJpYXQiOjE3NDE1MDI2NzIsImV4cCI6MTc0MTU4OTA3Miwic2Vzc2lvbl9pZCI6IjJfTVg0ME56a3dOVFF5TVg1LU1UYzBNVFV3TWpZM01qUXdNMzU0THpKTGNFazFWSHBxYTFGS1NWQjBMM0pLZDNGb2JGWi1VSDUtIiwiY3JlYXRlX3RpbWUiOjE3NDE1MDI2NzIsIm5vbmNlIjowLjkwNTI1MTc5NTY4MjUzNzksInJvbGUiOiJwdWJsaXNoZXIiLCJleHBpcmVfdGltZSI6MTc0MTU4OTA3MiwiaW5pdGlhbF9sYXlvdXRfY2xhc3NfbGlzdCI6IiIsInNjb3BlIjoic2Vzc2lvbi5jb25uZWN0In0.jHDoAlM53HkFMbXQhD1iOFOtgdmWhELQWvcD2JSnhqI';

You must pass a valid API key, session ID, and token when connecting to an OpenTok session. These credentials are usually generated by your server but we generated them for you this time.

OK, I added it