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

@allen,

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

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. :

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 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.

1 Like