# Generate SDK Signature with ASP.NET Core (C#) backend

**URL:** <https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401>\
**Category:** Web\
**Tags:** api\
**Created:** [November 7, 2022, 6:36am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401 "2022-11-07T06:36:46Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 7, 2022, 6:36am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/1 "2022-11-07T06:36:46Z")

</div>

Hello there,

With the JWT app type being deprecated soon, what is the right approach to generate the Web SDK Signature with an [ASP.NET](http://ASP.NET) Core (C#) backend? Looking at the link below, it appears the example is using JWT.

[https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature/](https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature/)

Thank you.

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 8, 2022, 10:14pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/2 "2022-11-08T22:14:26Z")

</div>

Can you help confirm the correct C# function to generate SDK JWT @donte.zoom ?

---

<div class="post-metadata">

**Author:** ![frederik.gysel](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/frederik.gysel/32/26431_2.png) [@frederik.gysel](https://devforum.zoom.us/u/frederik.gysel)\
**Post date:** [November 20, 2022, 2:32pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/3 "2022-11-20T14:32:42Z")

</div>

you can find C# code here:

> **[Authorization](https://marketplace.zoom.us/docs/sdk/native-sdks/auth/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

Rgds  
Frederik

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 29, 2022, 12:25am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/5 "2022-11-29T00:25:49Z")

</div>

> [@frederik.gysel](#):
>
> you can find C# code here:
> 
> [https://marketplace.zoom.us/docs/sdk/native-sdks/auth/](https://marketplace.zoom.us/docs/sdk/native-sdks/auth/)
> 
> Rgds  
> Frederik

Thanks, but I just want to confirm with Zoom Support that the JWT token signature generation method is still valid after June 2023.

Hi @donte.zoom , I met you during Zoomtopia and had an extensive talk on this topic. Are you able to confirm that using JWT token to generate signature will still be valid after June 2023? Thanks.

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [November 29, 2022, 2:19am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/6 "2022-11-29T02:19:36Z")

</div>

Hi, @allen,

Thanks for the tags! I hope you are doing well and had a great long weekend. To answer your question, yes JWT token signature generation will be deprecated in June 2023.

# JThe JWT app type (deprecated in June 2023. )

[https://marketplace.zoom.us/docs/guides/auth/jwt/](https://marketplace.zoom.us/docs/guides/auth/jwt/)

You should instead generate SDK JWT token signature with the Meeting SDK Marketplace app type. Here is our documentation on this topic:

# Meeting SDK Marketplace app typ

[https://marketplace.zoom.us/docs/guides/build/sdk-app/](https://marketplace.zoom.us/docs/guides/build/sdk-app/)

You may also be interested in checking our JWT migration support articles:

# JWT App Type Deprecation FAQ

[https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-faq/](https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-faq/)

# JWT app type migration guide

[https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-app-migration/](https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-app-migration/)

Let me know if this helps to clarify or if you have any additional questions.

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 29, 2022, 3:12am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/7 "2022-11-29T03:12:18Z")

</div>

So what is the best way to generate the SDK app signature if my backend is [asp.net](http://asp.net) core (C#)?

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [November 29, 2022, 3:56pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/8 "2022-11-29T15:56:42Z")

</div>

@allen ,

Great question! I believe you just need to create a function that handles creating the SDK JWT and endpoint that will return the token. The endpoint should be a POST and take the meeting number and role.

**POST** [http://localhost:8080](http://localhost:8080)  
{  
“meetingNumber”: “94843468909”,  
“role”: 0  
}

SDK JWT consists of three parts:

1. **Header** : encoded data of the token type and the algorithm used to sign the data.

```auto
{
  "alg": "HS256",
  "typ": "JWT"
}

```

1. **Payload** : encoded data of claims intended to share.

```auto
{
  "appKey": SDK_KEY,
  "sdkKey": SDK_KEY,
  "mn": MEETING_NUMBER,
  "role": ROLE,
  "iat": 1646937553,
  "exp": 1646944753,
  "tokenExp": 1646944753
}

```

1. **Signature** : created by signing (encoded header + encoded payload) using the SDK secret through an HMAC SHA256 algorithm.

```auto
HMACSHA256(
  base64UrlEncode(header) + '.' + base64UrlEncode(payload),
  SDK_SECRET
);

```

Here is our help documentation with those details for your reference 😃

## Generate the SDK JWT

[https://marketplace.zoom.us/docs/sdk/native-sdks/auth/#generate-the-sdk-jwt](https://marketplace.zoom.us/docs/sdk/native-sdks/auth/#generate-the-sdk-jwt)

Let me know if I missing anything. If so, can you share more details regarding your current implementation? This will help provide more context on what needs to be changed. In the meantime, I did some googling and found some helpful resources on generating JWT tokens.

> **[Generate tokens with dotnet user-jwts](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/jwt-authn?view=aspnetcore-7.0&tabs=linux)**
>
> Learn how to set up manage JSON Web Tokens in development with dotnet user-jwts

> **[How to Implement JWT Authentication in Web API Using .Net 6.0, Asp.Net Core](https://www.c-sharpcorner.com/article/how-to-implement-jwt-authentication-in-web-api-using-net-6-0-asp-net-core/)**
>
> In this article, we are going to create a REST API using .Net 6.0, ASP.NET Core and perform basic CRUD operations, create a JWT token, and secure the APIs by implementing JWT Authentication.

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 29, 2022, 5:27pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/9 "2022-11-29T17:27:54Z")

</div>

Thank you for the reply. Our implementation is straightforward - we use [asp.net](http://asp.net) core 6 in our backend and plain JavaScript and HTML/CSS for our front end. We will be using the Zoom Web SDK and want to generate the signature from the backend using the api key and secret and pass the signature to the front end to start the meeting.

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 29, 2022, 6:17pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/10 "2022-11-29T18:17:49Z")

</div>

Okay, @donte.zoom I think I see what you have here is for Node.js. That is fine because we have an app using Node.js and there is a GitHub example repo, but for our other app, which is [asp.net](http://asp.net) Core MVC, again, we just want to confirm that this method will still work after 2023 since it is using jwt token, as long as we swap out the API Key and Secret using the SDK Key and Secret?

Link - [https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature/#sdk-app-type](https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature/#sdk-app-type)

```auto
// this demo use vscode and .NET Core 2.2.5
// https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code
// https://dotnet.microsoft.com/download
// dotnet add package Microsoft.IdentityModel.Tokens
// dotnet add package System.IdentityModel.Tokens.Jwt
// https://www.red-gate.com/simple-talk/dotnet/net-development/jwt-authentication-microservices-net/
// https://www.jokecamp.com/blog/examples-of-creating-base64-hashes-using-hmac-sha256-in-different-languages/#csharp
// https://marketplace.zoom.us/docs/sdk/native-sdks/Web-Client-SDK/tutorial/generate-signature
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Text;
using Microsoft.IdentityModel.Tokens;
namespace Zoom {
    class Program {
        static readonly char[] padding = { '=' };
        static void Main (string[] args) {
            Console.WriteLine ("Zoom copyright!");
            Console.WriteLine ("generate websdk token!");
            string apiKey = "apiKey";
            string apiSecret = "apiSecret";
            string meetingNumber = "";
            String ts = (ToTimestamp(DateTime.UtcNow.ToUniversalTime()) - 30000).ToString();
            string role = "1";
            string token = GenerateToken (apiKey, apiSecret, meetingNumber, ts, role);
            Console.WriteLine (token);
        }
        public static long ToTimestamp (DateTime value) {
            long epoch = (value.Ticks - 621355968000000000) / 10000;
            return epoch;
        }
        public static string GenerateToken (string apiKey, string apiSecret, string meetingNumber, string ts, string role) {
            string message = String.Format ("{0}{1}{2}{3}", apiKey, meetingNumber, ts, role);
            apiSecret = apiSecret ?? "";
            var encoding = new System.Text.ASCIIEncoding ();
            byte[] keyByte = encoding.GetBytes (apiSecret);
            byte[] messageBytesTest = encoding.GetBytes (message);
            string msgHashPreHmac = System.Convert.ToBase64String (messageBytesTest);
            byte[] messageBytes = encoding.GetBytes (msgHashPreHmac);
            using (var hmacsha256 = new HMACSHA256 (keyByte)) {
                byte[] hashmessage = hmacsha256.ComputeHash (messageBytes);
                string msgHash = System.Convert.ToBase64String (hashmessage);
                string token = String.Format ("{0}.{1}.{2}.{3}.{4}", apiKey, meetingNumber, ts, role, msgHash);
                var tokenBytes = System.Text.Encoding.UTF8.GetBytes (token);
                return System.Convert.ToBase64String (tokenBytes).TrimEnd (padding);
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [November 29, 2022, 6:59pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/11 "2022-11-29T18:59:44Z")

</div>

@allen,

The method looks good, but I’d recommend testing it to be sure. All you would have to do is:

1. Swap out the values API Key and Secret - for - the SDK Key and Secret

2. Run the code to generate the signature

3. Then verify it by using the signature to Auth the SDK

4. You can also decode the signature with [JWT.io](http://JWT.io) to confirm as well

I see you mentioned our Sample Signature Node.js so I’m linking it below in case anyone else is interested in taking a look at the implementation.

# Zoom Meeting SDK Sample Signature Node.js

> **[GitHub - zoom/meetingsdk-auth-endpoint-sample: Generate a Meeting SDK JWT to join Zoom meetings...](https://github.com/zoom/meetingsdk-auth-endpoint-sample)**
>
> Generate a Meeting SDK JWT to join Zoom meetings and webinars with the Meeting SDK.

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 30, 2022, 6:04am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/12 "2022-11-30T06:04:26Z")

</div>

@donte.zoom

Unfortunately, I did a test using the Meeting SDK Web Sample and got an invalid signature error. I entered the signature to [jwt.io](http://jwt.io) and it was an invalid signature.

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [November 30, 2022, 6:52am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/13 "2022-11-30T06:52:52Z")

</div>

for the current Meeting SDK Web Sample you need Meeting SDK App

what is the status of your Meeting SDK app - activated?

![b127cfc3fccc53582915269b76f9a112ed81ee76](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/a/a/aa73e995440fcc3a5cd8da969a578f14d682dbff.png)

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [November 30, 2022, 6:27pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/14 "2022-11-30T18:27:07Z")

</div>

Definitely activated. It is the sample I pulled from Zoom GitHub here - [https://github.com/zoom/meetingsdk-web-sample](https://github.com/zoom/meetingsdk-web-sample)

I had it working before using the SDK Key and Secret. Now I replaced the lines in index.js -

[//meetingConfig.signature](https://meetingConfig.signature) = res.result;  
meetingConfig.signature = “ABC”;

with the generated signature, and it doesn’t work.

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [November 30, 2022, 7:20pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/15 "2022-11-30T19:20:24Z")

</div>

@allen,

Did some testing on my side with C# and I can confirm the following script works as expected with the Web SDK.

```auto
using System;
using System.Collections.Generic;
using System.Text;
using Jose;

  public class ZoomHelper
  {
      static readonly string sdkKey = "ENTTER YOUR SDK KEY";
      static readonly string sdkSecret = "ENTTER YOUR SDK Secret";
      static readonly int roleId = 1; // 0 for participant, 1 for host
      private static long ToEpoch(DateTime value) => (value.Ticks - 621355968000000000) / (10000 * 1000);
      public static string GetSignature(long meetingNumber)
      {
          var now = DateTime.UtcNow;
          var iat = ToEpoch(now);
          var exp = ToEpoch(now.AddDays(1));
          var payload = new Dictionary<string, object>()
          {
              { "appKey", sdkKey },
              { "sdkKey", sdkKey },
              { "mn", meetingNumber },
              { "role", roleId },
              { "iat", iat },
              { "exp", exp },
              { "tokenExp", exp },
          };
          return Jose.JWT.Encode(payload, Encoding.UTF8.GetBytes(sdkSecret), JwsAlgorithm.HS256);
      }
  }

```

For context, I grab the code snippet from the link below and generated it using a simple C# console app with VScode. :

> **[Authorization](https://marketplace.zoom.us/docs/sdk/native-sdks/auth/#3-pass-zak-token-to-the-sdk)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

That aside, I am working on what will either be a demo app or blog on generating the Web SDK Signature with an [ASP.NET](http://asp.net/) Core (C#) backend. Still getting familiar with C# so I will need a little time. In the meantime, feel free to tag me here for updates on that project.

---

<div class="post-metadata">

**Author:** ![allen](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@allen](https://devforum.zoom.us/u/allen)\
**Post date:** [December 1, 2022, 5:58am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/16 "2022-12-01T05:58:06Z")

</div>

Awesome! I tested this, and it works! Thank you so much for the help. I will keep an eye out for your demo app.

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [December 1, 2022, 9:40pm UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/17 "2022-12-01T21:40:11Z")

</div>

Phenomenal – super glad to hear you are up and going, @allen! Should you have any additional questions, please feel free to let us know!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 1, 2023, 7:40am UTC](https://devforum.zoom.us/t/generate-sdk-signature-with-asp-net-core-c-backend/78401/18 "2023-01-01T07:40:33Z")

</div>

Closed on January 1, 2023, 7:40am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
