Setting Up Authentication
In order to connect to a Vonage Video session, the client will need access to some authentication credentials — an APP ID, session ID, and token. In a production application, these credentials should be generated by a Server SDKs, but to speed things up we will hard code the values for now:
- Start by copying the following code block and adding it to your ViewController.swift file:
// Replace with your OpenTok APP ID
var kApiKey = ""
// Replace with your generated session ID
var kSessionId = ""
// Replace with your generated token
var kToken = ""
Important: Please note that your App ID is your API key.
Add these lines before the class ViewController declaration.
- Adjust the code by hard coding the values for the
kApiKey,kSessionIdandkToken.
To do this, log into your Video API account, either create a new Vonage Video API project or use an existing Vonage API project, then go to your project page and scroll down to the Project Tools section. From there, you can generate a session ID and token manually. Use the project's API key along with the session ID and token you generated.
Important: You can continue to get the session ID and token values from your Account during testing and development, but before you go into production you must set up a server.
For more information on sessions, tokens, and servers, check out Video API Basics.
Basic video chat
Learn the basic concepts of the Vonage Video API platform, including how users can communicate through video, voice, and messaging. Explore a basic Vonage Video API flow.