ZoomNet
Release Notes | NuGet (stable) | MyGet (prerelease) |
---|---|---|
About
Installation
The easiest way to include ZoomNet in your C# project is by adding the nuget package to your project:
PM> Install-Package ZoomNet
.NET framework suport
StrongGrid supports the 4.6.1
.NET framework as well as any framework supporting .NET Standard 2.0
(which includes .NET 4.7.2
, .NET 4.8
, .NET Core 2.x
, .NET Core 3.x
, ASP.NET Core 2.x
and ASP.NET Core 3.x
).
Usage
Connection Information
Before you start using the ZoomNet client, you must decide how you are going to connect to the Zoom API. ZoomNet supports two distinct ways of connecting to Zoom: JWT and OAuth.
Connection using JWT
This is the simplest way to connect to the Zoom API. Zoom expects you to use a key and a secret to generate a JSON object with a signed payload and to provide this JSON object with every API request. The good news is that ZoomNet takes care of the intricacies of generating this JSON object: you simply provide the key and the secret and ZommNet takes care of the rest. Super easy!
As the Zoom documentation mentions, this is perfect if you’re looking to build an app that provides server-to-server interaction with Zoom APIs
.
Here is an except from the Zoom documentation that explains how to get your API key and secret:
JWT apps provide an API Key and Secret required to authenticate with JWT. To access the API Key and Secret, Create a JWT App on the Marketplace. After providing basic information about your app, locate your API Key and Secret in the App Credentials page.
When you have the API key and secret, you can instantiate a 'connection info' object like so:
var apiKey = "... your API key ...";
var apiSecret = "... your API secret ...";
var connectionInfo = new JwtConnectionInfo(apiKey, apiSecret);
Connection using OAuth
Using OAuth is much more complicated than using JWT but at the same time, it is more flexible because you can define which permissions your app requires. When a user installs your app, they are presented with the list of permission your app requires and the are given the opportunity to accept.
The Zoom documentation has a document about how to create an OAuth app and another document about the OAuth autorization flow but I personnality was very confused by the later document so here is a brief step-by-step summary:
- you create an OAuth app, define which permissions your app requires and publish the app in the Zoom marketplace.
- user installs your app. During installation, user is presentd with a screen listing the permissons your app requires. User must click
accept
. - Zoom generates a "authorization code". This code can be used only once to generate the first access token and refresh token. I CAN'T STRESS THIS ENOUGH: the autorization code can be used only one time. This was the confusing part to me: somehow I didn't understand that this code could be used only one time and I was attempting to use it repeatedly. Zoom would accept the code one time and would reject it subsequently, which lead to many hours of frustration while trying to figure out why the code was sometimes rejected.
- The access token is valid for 60 minutes and must therefore be "refreshed" periodically.
ZoomNet takes care of generating the access token and refresh token but it's your responsability to store these generated values.
var clientId = "... your client ID ...";
var clientSecret = "... your client secret ...";
var refreshToken = "... the refresh token previously issued by Zoom ...";
var accessToken = "... the access token previously issued by Zoom ...";
var connectionInfo = new OAuthConnectionInfo(clientId, clientSecret, refreshToken, accessToken,
(newRefreshToken, newAccessToken) =>
{
/*
Save the new refresh token and the access token to
a safe place so you can provide it the next time
you need to instantiate an OAuthConnectionInfo
*/
});
Client
You declare your client variable like so:
var zoomClient = new ZoomClient(connectionInfo);