Creating Sessions & Tokens
Combining knowledge from other courses, learn build a project with the Vonage Video API
create-session.js
require('dotenv').config();
let opentok = require('opentok');
let OT = new opentok(process.env.API_KEY, process.env.API_SECRET);
OT.createSession(function(error, result) {
console.log(result);
});
generate-token.js
require('dotenv').config();
let opentok = require('opentok');
let OT = new opentok(process.env.API_KEY, process.env.API_SECRET);
let token = OT.generateToken('session-id', { role: 'publisher' });
console.log(token);
Need help? Have questions? Join the Vonage Developer Community Slack and use the channel #onehack.