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:
- Token generated is Ymg5TlJSak1TN3FuTmFoU05JMjF1dy43NDM0MTUxMzE0LjEyODkyOC4xLldNZm14RXJpVmRYMWpHQS9FK2ZFNkExWE4zZkZabC9KSi93Mm9RYU5QWXM9
- 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.