Session
In order to communicate with our infrastructure, you need to setup a session and initialize VideoKit with an API token for your App.
To enhance security, VideoKit supports two authentication mechanisms to verify users before accessing our video services: App ID or by Session Token.
Authentication | Description | Security |
---|---|---|
API Token | One Token for all requests | Low security since App Token needs to be shipped with your client builds and could be taken over by reverse engineering your build. |
Session Token | Every client gets their own session token | High security because every client retrieves their own authentication token through your backend. |
#
Get API Token for your AppFirst, you need to access your secret API token that consists of your App ID and a specific Token for authenticating with our backend.
To retrieve your token, login to dashboard.video.io and navigate to Apps → Your App → API TOKEN.
#
API Token Authentication (less secure)Go to your AppDelegate and import VideoKitCore
.
Call VKSession.current.start
from your AppDelegates didFinishLaunchingWithOptions:
You should now be authenticated and ready to use VideoKit.
Please be aware that this authentication method is not secure and only recommended for development purposes. We recommend to only use the more secure Session Token Authentication in your production environment.
#
Session ID Authentication (more secure)Go to your AppDelegate and import VideoKitCore
.
#
Retreive Session Token from your BackendIn order to generate a user session securely, you will need to implement a backend service that knows the API token and is in charge of your user's session management.
To get an idea of how it works, please take a look at our example written in Node.js: https://github.com/Video-io/videokit-nodejs
#
Sign in with Session Token#
Node.js Express backend exampleHere is a simple example using a Node.js express server:
Working example: https://runkit.com/dstuecken/videokit-node-js-example/3.0.0