Use of this sample app is subject to our Terms of Use.
This is a Node.js / Express server that generates a Cobrowse SDK JWT via an HTTP request for authorized use of the Zoom Cobrowse SDK.
If you would like to skip these steps and just deploy the finished code to a managed service, click the Deploy to Railway/Render/Heroku button. (You will still need to configure a few simple things, so skip to Deployment.)
Railway | Render | Heroku |
---|---|---|
Note: Both Railway and Render have free tiers, but Heroku requires a credit card to deploy.
In terminal, run the following command to clone the repository:
$ git clone https://github.com/zoom/cobrowsesdk-auth-endpoint-sample.git
-
In terminal,
cd
into the cloned repository:$ cd cobrowsesdk-auth-endpoint-sample
-
Then install the dependencies:
$ npm install
-
Rename
example.env
to.env
, edit the file contents to include your Zoom SDK key and secret, save the file contents, and close the file:
-
Start the server:
$ npm run start
Make a POST request to http://localhost:4000
(or your deployed url) with the following request body:
Property | Type | Required? | Validation Rule(s) |
---|---|---|---|
role |
number |
Yes | - Required - Must equal to 1 or 2 |
expirationSeconds |
number |
No | - Must be between 1800 (30 minutes) and 172800 (48 hours) seconds |
userId |
string |
No | - Please ensure that the user ID is not repeated within a session |
userName |
string |
No |
Note:
userId
is required to create a JWT, if not provided a random string will be used.
POST http://localhost:4000
Request Body:
{
"role": 1,
"userId": "user123",
"userName": "ekaansh"
}
If successful, the response body will be a JSON representation of your token:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBfa2V5IjoiM2YzV0pkZ0FTZC0xN1VZTl9ZSmFQQSIsInJvbGVfdHlwZSI6MCwiaWF0IjoxNzI5MTU5MDkyLCJleHAiOjE3MjkxNjYyOTIsInVzZXJfaWQiOiJ1c2VyMTIzIn0.cVMgCnb5fJzhGr2nTowlYWojAdYiH2INMUhh5v2WTos"
}
In the Cobrowse SDK, for the agent you can pass in the token
to the ACCESS_TOKEN
in your iframe.
<iframe src="<YOUR_URL>/desk?access_token=TOKEN>`>
For the customer you can pass in the token
to the sdkToken
in the start
method of the session:
// Make http request to your auth endpoint to get the Cobrowse SDK JWT
ZoomCobrowseSDK.init(settings, function ({ success, session, error }) {
...
session.start({
sdkToken: token,
});
})
-
After clicking the "Deploy to <Provider>" button, enter a name for your app (or leave it blank to have a name generated for you), and insert your Zoom SDK credentials:
ZOOM_SDK_KEY
(Your Zoom SDK Key, found on your Zoom SDK App's Credentials page)ZOOM_SDK_SECRET
(Your Zoom SDK Secret, found on your Zoom SDK App's Credentials page)
-
Then click "Deploy App".
-
Use your URL as your Cobrowse SDK Auth Endpoint.
Example:
https://abc123.provider.com/
$ curl <YOU_URL> -X POST -d '{ "role": "1", "userId": "user123", "userName": "ekaansh"}' -H "Content-Type: application/json"
-
For Other Server Hosting information, see this tutorial.
-
Use your deployed URL as your Cobrowse SDK Auth Endpoint.
Example:
https://abc123.compute-1.amazonaws.com/
Now you can generate your Cobrowse SDK JWT.
If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.