public static string sGenerateJwtToken()
{
// Token will be good for 20 minutes
DateTime Expiry = DateTime.UtcNow.AddMinutes(20);
string ApiKey = sApiKey;
string ApiSecret = sApiSecret;
string SdkKey = sSdkKey;
string SdkSecret = sSdkSecret;
int ts = (int)(Expiry - new DateTime(1970, 1, 1)).TotalSeconds;
// Create Security key using private key above:
//var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(ApiSecret));
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);
//Zoom Required Payload
var payload = new JwtPayload
{
{"appKey",SdkKey},
{ "sdkKey", SdkKey },
{ "exp", ts },
};
var secToken = new JwtSecurityToken(header, payload);
var handler = new JwtSecurityTokenHandler();
// Token to String so you can use it in your client
var tokenString = handler.WriteToken(secToken);
return tokenString;
}