ZoomNet 0.53.0
See the version list below for details.
dotnet add package ZoomNet --version 0.53.0
NuGet\Install-Package ZoomNet -Version 0.53.0
<PackageReference Include="ZoomNet" Version="0.53.0" />
paket add ZoomNet --version 0.53.0
#r "nuget: ZoomNet, 0.53.0"
// Install ZoomNet as a Cake Addin #addin nuget:?package=ZoomNet&version=0.53.0 // Install ZoomNet as a Cake Tool #tool nuget:?package=ZoomNet&version=0.53.0
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
ZoomNet currently supports:
- .NET framework 4.8
- any framework supporting
.NET Standard 2.1
(which includes.NET Core 3.x
andASP.NET Core 3.x
) .NET 5.0
.NET 6.0
The last version of ZoomNet that supported .NET 4.6.1
, .NET 4.7.2
and .NET Standard 2.0
was 0.35.0
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 three ways of connecting to Zoom: JWT, OAuth and Server-to-Server 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 ZoomNet 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);
var zoomClient = new ZoomClient(connectionInfo);
Warning: <a href="https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-faq/">Zoom has announced</a> that this authentication method would be obsolete in June 2023. The recommendation is to swith to Server-to-Server OAuth.
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 permissions your app requires and they 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 authorization 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 the first 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.
When you initially add an OAuth application to your Zoom account, you will be issued an "authorization code". You can provide this autorization code to ZoomNet like so:
var clientId = "... your client ID ...";
var clientSecret = "... your client secret ...";
var refreshToken = "... the refresh token previously issued by Zoom ...";
var authorizationCode = "... the code that Zoom issued when you added the OAuth app to your account ...";
var redirectUri = "... the URI you have configured when setting up your OAuth app ..."; // Please note that Zoom sometimes accepts a null value and sometimes rejects it with a 'Redirect URI mismatch' error
var connectionInfo = new OAuthConnectionInfo(clientId, clientSecret, authorizationCode,
(newRefreshToken, newAccessToken) =>
{
/*
This callback is invoked when the authorization code
is converted into an access token and also when the
access token is subsequently refreshed.
You should use this callback to save the two new tokens
to a safe place so you can provide them the next time you
need to instantiate an OAuthConnectionInfo.
For demonstration purposes, here's how you could use your
operating system's environment variables to store the tokens:
*/
Environment.SetEnvironmentVariable("ZOOM_OAUTH_REFRESHTOKEN", newRefreshToken, EnvironmentVariableTarget.User);
Environment.SetEnvironmentVariable("ZOOM_OAUTH_ACCESSTOKEN", newAccessToken, EnvironmentVariableTarget.User);
},
redirectUri);
var zoomClient = new ZoomClient(connectionInfo);
Warning: This sample I just provided can be used only when Zoom issues a new the autorization code. ZoomNet will take care of converting this code into an access token at which point the autorization code is no longer valid.
Once the autorization code is converted into an access token, you can instantiate a 'connection info' object like so:
var clientId = "... your client ID ...";
var clientSecret = "... your client secret ...";
var refreshToken = Environment.GetEnvironmentVariable("ZOOM_OAUTH_REFRESHTOKEN", EnvironmentVariableTarget.User);
var accessToken = Environment.GetEnvironmentVariable("ZOOM_OAUTH_ACCESSTOKEN", EnvironmentVariableTarget.User);
var connectionInfo = new OAuthConnectionInfo(clientId, clientSecret, refreshToken, accessToken,
(newRefreshToken, newAccessToken) =>
{
Environment.SetEnvironmentVariable("ZOOM_OAUTH_REFRESHTOKEN", newRefreshToken, EnvironmentVariableTarget.User);
Environment.SetEnvironmentVariable("ZOOM_OAUTH_ACCESSTOKEN", newAccessToken, EnvironmentVariableTarget.User);
});
var zoomClient = new ZoomClient(connectionInfo);
Connection using Server-to-Server OAuth
This authentication method is the replacement for JWT authentication which Zoom announced will be made obsolete in June 2023.
From Zoom's documentation:
A Server-to-Server OAuth app enables you to securely integrate with Zoom APIs and get your account owner access token without user interaction. This is different from the OAuth app type, which requires user authentication. See Using OAuth 2.0 for details.
ZoomNet takes care of getting a new access token and it also refreshes a previously issued token when it expires (Server-to-Server access token are valid for one hour).
var clientId = "... your client ID ...";
var clientSecret = "... your client secret ...";
var accountId = "... your account id ...";
var connectionInfo = new OAuthConnectionInfo(clientId, clientSecret, accountId,
(_, newAccessToken) =>
{
/*
Server-to-Server OAuth does not use a refresh token. That's why I used '_' as the first parameter
in this delegate declaration. Furthermore, ZoomNet will take care of getting a new access token
and to refresh it whenever it expires therefore there is no need for you to preserve the token
like you must do for the 'standard' OAuth authentication.
In fact, this delegate is completely optional when using Server-to-Server OAuth. Feel free to pass
a null value in lieu of a delegate.
*/
});
var zoomClient = new ZoomClient(connectionInfo);
The delegate being optional in the server-to-server scenario you can therefore simplify the connection info declaration like so:
var connectionInfo = new OAuthConnectionInfo(clientId, clientSecret, accountId, null);
var zoomClient = new ZoomClient(connectionInfo);
Webhook Parser
Here's a basic example of a .net 6.0 API controller which parses the webhook from Zoom:
using Microsoft.AspNetCore.Mvc;
using StrongGrid;
namespace WebApplication1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ZoomWebhooksController : ControllerBase
{
[HttpPost]
[Route("Event")]
public async Task<IActionResult> ReceiveEvent()
{
var parser = new WebhookParser();
var event = await parser.ParseEventWebhookAsync(Request.Body).ConfigureAwait(false);
// ... do something with the event ...
return Ok();
}
}
}
Ensuring that webhooks originated from Zoom before parsing
It is possible for you to verify that a webhook is legitimate and originated from Zoom. Any webhook that fails to be verified should be considered suspicious and should be discarded.
To get started, you need to make sure that a Secret Token
is associated with your Zoom Marketplace app (click the 'Regenerate' button if your app doesn't have such a token already) as demonstrated in this screenshot.
When your Marketplace app has a Secret Token
, Zoom will include two additional headers in the request posted to your endpoint and you must use the values in these headers to verify that the content your received is legitimate.
If you want to know what to do with these two values to determine if a webhook is legitimate or not, please review this page in the documentation.
But, ZoomNet strives to make your life easier so we have already implemented this logic.
The WebhookParser
class has a method called VerifyAndParseEventWebhookAsync
which will automatically verify the data and throw a security exception if verification fails. If the verification fails, you should consider the webhook data to be invalid. Here's how it works:
using Microsoft.AspNetCore.Mvc;
using StrongGrid;
using System.Security;
namespace WebApplication1.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ZoomWebhookController : ControllerBase
{
[HttpPost]
public async Task<IActionResult> ReceiveEvent()
{
try
{
// Get your secret token
var secretToken = "... your app's secret token ...";
// Get the signature and the timestamp from the request headers
var signature = Request.Headers[WebhookParser.SIGNATURE_HEADER_NAME].SingleOrDefault(); // SIGNATURE_HEADER_NAME is a convenient constant provided by ZoomNet so you don't have to remember the name of the header
var timestamp = Request.Headers[WebhookParser.TIMESTAMP_HEADER_NAME].SingleOrDefault(); // TIMESTAMP_HEADER_NAME is a convenient constant provided by ZoomNet so you don't have to remember the name of the header
// Parse the event. The signature will be automatically validated and a security exception thrown if unable to validate
var parser = new WebhookParser();
var event = await parser.VerifyAndParseEventWebhook(Request.Body, secretToken, signature, timestamp).ConfigureAwait(false);
// ... do something with the event...
}
catch (SecurityException e)
{
// ... unable to validate the data ...
}
return Ok();
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- HttpMultipartParser (>= 7.0.0)
- jose-jwt (>= 4.0.1)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Pathoschild.Http.FluentClient (>= 4.2.0)
- System.Text.Json (>= 6.0.6)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.1
- HttpMultipartParser (>= 7.0.0)
- jose-jwt (>= 4.0.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Pathoschild.Http.FluentClient (>= 4.2.0)
- System.Text.Json (>= 6.0.6)
- System.ValueTuple (>= 4.5.0)
-
net5.0
- HttpMultipartParser (>= 7.0.0)
- jose-jwt (>= 4.0.1)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Pathoschild.Http.FluentClient (>= 4.2.0)
- System.Text.Json (>= 6.0.6)
- System.ValueTuple (>= 4.5.0)
-
net6.0
- HttpMultipartParser (>= 7.0.0)
- jose-jwt (>= 4.0.1)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Pathoschild.Http.FluentClient (>= 4.2.0)
- System.Text.Json (>= 6.0.6)
- System.ValueTuple (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.84.0 | 253 | 11/15/2024 |
0.83.0 | 533 | 11/2/2024 |
0.82.0 | 537 | 10/26/2024 |
0.81.0 | 532 | 10/13/2024 |
0.80.0 | 3,651 | 8/7/2024 |
0.79.0 | 855 | 7/23/2024 |
0.78.0 | 1,086 | 7/12/2024 |
0.77.0 | 2,009 | 6/7/2024 |
0.76.0 | 7,172 | 4/27/2024 |
0.75.2 | 2,178 | 4/11/2024 |
0.75.1 | 314 | 4/8/2024 |
0.75.0 | 165 | 4/6/2024 |
0.74.0 | 30,487 | 2/16/2024 |
0.73.0 | 9,077 | 1/20/2024 |
0.72.0 | 3,563 | 12/9/2023 |
0.71.0 | 762 | 12/8/2023 |
0.70.0 | 1,943 | 11/21/2023 |
0.69.0 | 1,489 | 11/18/2023 |
0.68.0 | 2,660 | 11/2/2023 |
0.67.0 | 5,656 | 9/22/2023 |
0.66.0 | 11,002 | 7/30/2023 |
0.65.0 | 1,422 | 7/13/2023 |
0.64.0 | 831 | 6/26/2023 |
0.63.1 | 2,312 | 5/25/2023 |
0.63.0 | 2,214 | 5/23/2023 |
0.62.0 | 1,464 | 5/13/2023 |
0.61.0 | 3,102 | 5/1/2023 |
0.60.0 | 2,090 | 4/15/2023 |
0.59.1 | 926 | 3/30/2023 |
0.59.0 | 579 | 3/29/2023 |
0.58.0 | 5,781 | 1/26/2023 |
0.57.0 | 672 | 1/23/2023 |
0.56.0 | 950 | 1/11/2023 |
0.55.0 | 5,760 | 12/23/2022 |
0.54.0 | 718 | 12/14/2022 |
0.53.0 | 6,120 | 11/22/2022 |
0.52.0 | 1,015 | 10/27/2022 |
0.51.1 | 2,602 | 9/26/2022 |
0.50.0 | 5,414 | 8/24/2022 |
0.49.0 | 1,445 | 8/16/2022 |
0.48.0 | 776 | 8/15/2022 |
0.47.0 | 1,225 | 8/3/2022 |
0.46.0 | 1,189 | 7/16/2022 |
0.45.0 | 877 | 7/8/2022 |
0.44.0 | 822 | 6/30/2022 |
0.43.0 | 4,235 | 5/31/2022 |
0.42.3 | 10,483 | 4/27/2022 |
0.42.2 | 740 | 4/25/2022 |
0.42.1 | 11,213 | 3/12/2022 |
0.42.0 | 3,643 | 3/7/2022 |
0.41.0 | 4,816 | 3/1/2022 |
0.40.0 | 969 | 2/22/2022 |
0.39.0 | 1,765 | 2/4/2022 |
0.38.0 | 786 | 1/31/2022 |
0.37.0 | 1,116 | 1/15/2022 |
0.36.0 | 8,584 | 11/29/2021 |
0.35.0 | 1,005 | 11/17/2021 |
0.34.0 | 1,938 | 10/25/2021 |
0.33.0 | 3,415 | 10/4/2021 |
0.32.4 | 807 | 9/21/2021 |
0.32.3 | 721 | 9/21/2021 |
0.32.2 | 7,549 | 9/16/2021 |
0.32.1 | 625 | 9/15/2021 |
0.31.0 | 25,843 | 6/7/2021 |
0.30.0 | 823 | 6/1/2021 |
0.29.0 | 24,923 | 5/12/2021 |
0.28.0 | 704 | 5/11/2021 |
0.27.2 | 2,666 | 4/7/2021 |
0.27.1 | 1,000 | 3/26/2021 |
0.27.0 | 690 | 3/25/2021 |
0.26.0 | 894 | 3/18/2021 |
0.25.0 | 959 | 3/4/2021 |
0.24.0 | 785 | 3/1/2021 |
0.23.0 | 90,995 | 2/27/2021 |
0.22.0 | 687 | 2/27/2021 |
0.21.0 | 1,036 | 2/18/2021 |
0.20.0 | 708 | 2/13/2021 |
0.19.0 | 853 | 2/9/2021 |
0.18.0 | 1,902 | 1/26/2021 |
0.17.0 | 761 | 1/22/2021 |
0.16.0 | 1,775 | 1/20/2021 |
0.15.0 | 4,616 | 1/14/2021 |
0.14.0 | 774 | 1/12/2021 |
0.13.0 | 744 | 1/12/2021 |
0.12.0 | 777 | 1/6/2021 |
0.11.0 | 918 | 12/31/2020 |
0.10.0 | 1,460 | 11/22/2020 |
0.9.0 | 14,762 | 10/2/2020 |
0.8.3 | 2,238 | 9/9/2020 |
0.8.2 | 774 | 9/8/2020 |
0.8.1 | 817 | 9/7/2020 |
0.7.0 | 775 | 8/29/2020 |
0.6.0 | 27,434 | 6/30/2020 |
0.5.1 | 845 | 6/17/2020 |
0.5.0 | 800 | 6/15/2020 |
0.4.1 | 867 | 6/1/2020 |
0.4.0 | 826 | 5/27/2020 |
0.3.0 | 767 | 5/26/2020 |
0.2.0 | 815 | 5/11/2020 |
0.1.0 | 830 | 5/6/2020 |