Web Meetings SDK | Authorization and Device Registration
Authorization and device registration are important first steps in starting a meeting using the Web SDK. This document helps in using SDK for authenticating a user and registering the device with the Webex Meetings servers.
anchorInitialize the SDK
anchorTo use the SDK, you'll need a free Webex account; if you don't have a Cisco Webex account, visit Cisco Webex for Developers to create your account and retrieve your access token from Getting and Using your Personal Access Token.
To create a new Webex instance:
const webex = Webex.init({
credentials: {
access_token: `<AUTHORIZATION/BOT TOKEN>`
}
});
At this point, the Webex Meetings
object is ready for use. The Meetings
object contains a list of meetings as well as methods to perform specific operations or listen for certain events. Detailed information is included in this article.
For more information on the Meetings
object, see Webex Messaging documentation.
anchorRetrieve a Meeting Object
anchorThe Meetings
object is accessible from the Webex
object:
const webex = new Webex.init();
const meetings = webex.meetings;
The meetings
constant contains an instance of the Webex Meetings
object.
anchorRegister a Meeting Device
anchorOnce the Meetings
object is instantiated, you can register a device using its register()
method:
const webex = new Webex.init();
await webex.meetings.register();
Asynchronous | Yes |
Parameters | No parameters required |
Returns | Promise<undefined> |
anchorDeregister a Meeting Device
anchorYou can deregister a registered device using the Meetings
object's unregister()
method:
await webex.meetings.unregister();
anchorMeetings Ready Event
anchorA ready
event fires when a Meetings
object is ready for use. A Meetings
object instance is ready once the containing Webex
object is ready, and all the Meetings
object's instance parameters are set. You can subscribe to the ready event immediately following Webex.init
:
webex.meetings.on('meetings:ready',() => {
console.log('Meetings object is ready for device registration');
// Register a new device...
});
The ready event returns no payload.
Make any Meetings object method calls only after receiving this event.
anchorMeetings Registered Event
anchorThe registered
event is emitted by a Meetings object after you call the register()
method:
webex.meetings.on('meetings:registered',() => {
console.log('Meetings object is ready to perform other operations');
// Perform meeting operations like create, sync, etc.
});