I am getting a signature and also can able to join the meeting after the end of one meeting.
creating another meeting that time I am getting the signature invalid issue.
kindly some buddy help me.
below i have mentioned the signature generate function.
1] How we can identify whether the particular signature is valid for certain time ? OR Expiry logic ?
2] Is there any time conversion / Offset is required to generate the signature ?
3] How signature gets validated on zoom server, I mean what kind of parameter consider while checking the signature in order to run the zoom meeeting ?
private static long ToEpoch(DateTime value) => (value.Ticks - 621355968000000000) / (10000 * 1000);
public static string GenerateZoomSdkToken(string sdkKey, string sdkSecret, string meetingNumber,string role)
{
var now = DateTime.UtcNow;
int roleId = Convert.ToInt32(role);
Int64 MeetingNumber = Convert.ToInt64(meetingNumber);
var iat = ToEpoch(now);
// var exp = ToEpoch(now.AddMinutes(2));
var exp = ToEpoch(now.AddMinutes(10));
// Create Security key using private key above:
var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(sdkSecret));
// length should be >256b
var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
//Finally create a Token
var header = new JwtHeader(credentials);
var zoomPayload = new JwtPayload{
{"sdkKey", sdkKey},
{"mn", MeetingNumber},
{"role", roleId},
{"iat", iat},
{"exp", exp},
{"appKey",sdkKey},
{"tokenExp", exp}
};
var secToken = new JwtSecurityToken(header, zoomPayload);
var handler = new JwtSecurityTokenHandler();
// Token to String so you can use it in your client
var tokenString = handler.WriteToken(secToken);
return tokenString;
}