# Signature is invalid for Web SDK and JWT app

**URL:** <https://devforum.zoom.us/t/signature-is-invalid-for-web-sdk-and-jwt-app/59707>\
**Category:** Web\
**Created:** [November 2, 2021, 9:25pm UTC](https://devforum.zoom.us/t/signature-is-invalid-for-web-sdk-and-jwt-app/59707 "2021-11-02T21:25:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nefcanto](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/nefcanto/32/32375_2.png) [@nefcanto](https://devforum.zoom.us/u/nefcanto)\
**Post date:** [November 2, 2021, 9:25pm UTC](https://devforum.zoom.us/t/signature-is-invalid-for-web-sdk-and-jwt-app/59707/1 "2021-11-02T21:25:58Z")

</div>

**Description**  
I followed your docs step by step, and now I get `Signature is invalid` when trying to join to a meeting.

**Browser Console Error**  
I only see this error:

```auto
{
errorCode: 3712
reason: "Signature is invalid."
type: "JOIN_MEETING_FAILED"
}

```

**Which Web Meeting SDK version?**  
2.0.1 (_“@zoomus/websdk”: “^2.0.1”,_)

**Meeting SDK Code Snippets**  
Here’s my C# Controller code to generate signature:

```auto
static readonly char[] padding = { '=' };

[HttpGet]
public object GenerateToken(string meetingNumber)
{
    var apiKey = Config.GetSetting("ZoomApiKey");
    var apiSecret = Config.GetSetting("ZoomApiSecret");
    String timestamp = (ToTimestamp(DateTime.UtcNow.ToUniversalTime()) - 30000).ToString();
    var role = "0"; // 1 for host, 0 for participant

    string message = String.Format ("{0}{1}{2}{3}", apiKey, meetingNumber, timestamp, 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, timestamp, role, msgHash);
        var tokenBytes = System.Text.Encoding.UTF8.GetBytes(token);
        return new 
        {
            Signature = System.Convert.ToBase64String(tokenBytes).TrimEnd(padding)
        };
    }
}

public static long ToTimestamp (DateTime value) {
    long epoch = (value.Ticks - 621355968000000000) / 10000;
    return epoch;
}

```

As you can see, I just copied your code from [docs](https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature) and restructured it inside a controller. I also changed the return type. That’s all.

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:

- Create a JWT app in [marketplace.zoom.us](http://marketplace.zoom.us)
- Create a C# controller to return signature (using doc’s C# example)
- Create a react component to use that signature and meeting number + password to join a meeting
- Provide API Key from app’s credentials page to both react and C# controller
- Provide API secret from app’s credentials page

**Screenshots**

I tried to attach images, but your system complained that:

> Sorry, you can’t embed media items in a post.

**Device (please complete the following information):**

- Device: [Lenovo Thinkpad]
- OS: [Ubuntu 20.04, react docker =\> node:14-buster-slim, C# docker =\> Debian GNU/Linux 10 (buster)]
- Browser: [Chrome]
- Browser Version [95.0.4638.54 (Official Build) (64-bit)]

**Additional context**  
To be honest, your documentation is very confusing and vague. I did not have a good developer experience up until here. But I also thank you for creating such an amazing platform.

---

<div class="post-metadata">

**Author:** ![nefcanto](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/nefcanto/32/32375_2.png) [@nefcanto](https://devforum.zoom.us/u/nefcanto)\
**Post date:** [November 3, 2021, 7:49am UTC](https://devforum.zoom.us/t/signature-is-invalid-for-web-sdk-and-jwt-app/59707/2 "2021-11-03T07:49:33Z")

</div>

I also tried it with your node API that is ready to use. Still the same error.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 5, 2021, 8:33pm UTC](https://devforum.zoom.us/t/signature-is-invalid-for-web-sdk-and-jwt-app/59707/3 "2021-11-05T20:33:20Z")

</div>

Hey @nefcanto,

Thank you for reaching out to the Zoom Developer Forum. First, please make sure that you are using the API Key and Secret from a JWT App. From there, you may find this historical post to be useful:

> [@How to create JWT token using REST api in c#](https://devforum.zoom.us/t/how-to-create-jwt-token-using-rest-api-in-c/6620/13):
>
> This is what works for me on .Net Core 3.1.4 var setting = GetZoomSetting(); //This is where I picked the API Key and API Secret From var zone = TimeZoneInfo.FindSystemTimeZoneById("W. Central Africa Standard Time"); var utcNow = DateTime.UtcNow; var westNow = TimeZoneInfo.ConvertTimeFromUtc(utcNow, zone); string s = null; TimeSpan t = westNow.AddMinutes(Convert.ToInt32(5)) - new DateTime(1970, 1, 1); int secondsSinceEpoch = (int)t.TotalSeconds; …

Thanks,  
Max

---

<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:** [December 6, 2021, 6:34am UTC](https://devforum.zoom.us/t/signature-is-invalid-for-web-sdk-and-jwt-app/59707/4 "2021-12-06T06:34:05Z")

</div>

Closed on December 6, 2021, 6:34am UTC

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