Not able generate JWT token getting error 124 Invalid Access Token

Description
I am generating the JWT Token the code snippet is taken from the url https://marketplace.zoom.us/docs/sdk/native-sdks/web/essential/signature
Following is the code

string apiKey = “myapikey taken from the JWT App”;
string apiSecret = “myapisecret taken from the JWT App”;
string meetingNumber = “my meeting number”;
string role = “1”;

        DateTime Expiry = DateTime.UtcNow.AddMinutes(20);
        int ts = (int)(Expiry - new DateTime(2020, 4, 15)).TotalSeconds;

        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);
        }

The token is getting generated

Error
The full error message or issue you are running into.

Which App Type (JWT)?
app type is JWT

Which Endpoint/s?
meetings/{MEETING ID}

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

  1. Token generated is Ymg5TlJSak1TN3FuTmFoU05JMjF1dy43NDM0MTUxMzE0LjEyODkyOC4xLldNZm14RXJpVmRYMWpHQS9FK2ZFNkExWE4zZkZabC9KSi93Mm9RYU5QWXM9
  2. Consuming the API is giving {“code”:124,“message”:“Invalid access token.”} error.

Screenshots (If applicable)
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Hi,

We are sorry that you are running into this issue. What happens when you use the token generated from your Marketplace JWT app? Are you getting the same error? If so could you send me your Zoom Account Number listed on your Account Profile page via message?

Thank you,
Shrijana

The token that i generate from the Marketplace JWT app that works.
I don’t want to share my Account number here as others will be able to read that.

Hey @ShriG,

Happy to hear it is working!

Let us know if you run into any other issues.

Thanks,
tommy